You are not logged in.
Pages: 1
Hi, I'm working on ap project that users inotify.h, a module that is included in recent versions of glibc, but for example not in Debian Etch.
The thing is, in any modern distro I'd have to include sys/inotify.h, while in etch I have to include inotifytools/inotify.h. I've managed to do it in CMake with CHECK_INCLUDE_FILES and a config.h, but I found a cleaner solution that should work in theory but actually doesn't, for me:
src/CMakeList.txt
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
FIND_PACKAGE(Inotify REQUIRED)
IF(INOTIFY_FOUND)
INCLUDE_DIRECTORIES( ${INOTIFY_INCLUDE_DIR} )
ENDIF(INOTIFY_FOUND)
cmake_modules/FindInotify.cmake
IF (INOTIFY_FOUND)
IF (NOT Inotify_FIND_QUIETLY)
MESSAGE(STATUS "Found Inotify: ${INOTIFY_INCLUDE_DIR}")
ENDIF (NOT Inotify_FIND_QUIETLY)
ELSE (INOTIFY_FOUND)
IF (Inotify_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Inotify")
ENDIF (Inotify_FIND_REQUIRED)
ENDIF (INOTIFY_FOUND)
#INCLUDE(CheckIncludeFiles)
#CHECK_INCLUDE_FILES(sys/inotify.h HAVE_SYS_INOTIFY_H2)
#CHECK_INCLUDE_FILES(inotifytools/inotify.h HAVE_INOTIFYTOOLS_INOTIFY_H2)
INCLUDE_DIRECTORIES( ${INOTIFY_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
So, when I get the correct inotify path I get it into my include dirs, but if CMake can't find it gives an error. This should work, but how do I include inotify.h in my source? #include <inotify.h> or "inotify.h" doesn't seem to work.
Also, I've tried compiling this with plain g++, and I get a very weird error:
[raziel@Bebop klikd]$ g++ -I/usr/include/sys src/*.cpp -lpthread -lrt
In file included from /usr/include/sys/signal.h:1,
from /usr/include/sys/signal.h:1,
from /usr/include/sys/signal.h:1,
from /usr/include/sys/signal.h:1,
from /usr/include/sys/signal.h:1,
from /usr/include/sys/signal.h:1,
(...)
/usr/include/sys/signal.h:1:20: error: #include nested too deeply
In file included from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
from /usr/include/sys/unistd.h:1,
(...)
Being:
[raziel@Bebop klikd]$ cat /usr/include/sys/signal.h
#include <signal.h>
[raziel@Bebop klikd]$ cat /usr/include/sys/unistd.h
#include <unistd.h>
Is this normal?
Offline
I checked the files on my system. They contain exactly the same as yours. I suggest you use the include files in /usr/include, rather than /usr/include/sys.
No experience in using cmake.
Offline
That's that I want to avoid, as in debian etch they don't have /usr/include/sys/inotify.h, they have /usr/sys/inotifytools/inotify.h
Offline
Pages: 1