Check the system for inotify in cmake and use a config.h file.

This commit is contained in:
Klaas Freitag 2012-07-20 17:12:29 +02:00
parent 5246a6fad4
commit 4b33997678
4 changed files with 31 additions and 6 deletions

View file

@ -21,10 +21,13 @@ endif()
find_package(Qt4 4.6.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest REQUIRED )
find_package(Csync)
find_package(INotify)
set(WITH_CSYNC CSYNC_FOUND)
set(USE_INOTIFY INOTIFY_FOUND)
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
if(CSYNC_FOUND)
add_definitions(-DWITH_CSYNC)
endif(CSYNC_FOUND)
macro(add_tests)
foreach( loop_var ${ARGV} )

View file

@ -0,0 +1,19 @@
# This module defines
# INOTIFY_INCLUDE_DIR, where to find inotify.h, etc.
# INOTIFY_FOUND, If false, do not try to use inotify.
# also defined, but not for general use are
# INOTIFY_LIBRARY, where to find the inotify library.
find_path(INOTIFY_INCLUDE_DIR sys/inotify.h)
mark_as_advanced(INOTIFY_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set INOTIFY_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(INOTIFY DEFAULT_MSG INOTIFY_INCLUDE_DIR)
IF(INOTIFY_FOUND)
SET(INotify_INCLUDE_DIRS ${INOTIFY_INCLUDE_DIR})
ENDIF(INOTIFY_FOUND)

4
config.h.in Normal file
View file

@ -0,0 +1,4 @@
#cmakedefine USE_INOTIFY 1
#cmakedefine WITH_CSYNC 1

View file

@ -49,8 +49,7 @@ set(libsync_HEADERS
mirall/csyncthread.h
)
IF( USE_INOTIFY )
add_definitions( -DUSE_INOTIFY )
IF( INOTIFY_FOUND )
set(libsync_SRCS ${libsync_SRCS} mirall/inotify.cpp)
set(libsync_HEADERS ${libsync_HEADERS} mirall/inotify.h)
ENDIF()
@ -105,7 +104,7 @@ if( UNIX AND NOT APPLE)
endif()
# csync is required.
include_directories(${CSYNC_INCLUDE_DIR}/csync ${CSYNC_INCLUDE_DIR})
include_directories(${CSYNC_INCLUDE_DIR}/csync ${CSYNC_INCLUDE_DIR} ${CMAKE_BINARY_DIR})
qt4_wrap_cpp(mirallMoc ${mirall_HEADERS})