summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorChengwei Yang <chengwei.yang@intel.com>2013-06-28 10:48:15 +0800
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-06-28 11:55:52 +0100
commit1ec2e5a5387d131efc6affb7bfc49642c8186df8 (patch)
treeb74d833bae90d8e63e49e541b0a616b5d615eede /cmake
parent982bfa106d8f551190ea6f19f0a36cd89fff4b86 (diff)
downloaddbus-1ec2e5a5387d131efc6affb7bfc49642c8186df8.tar.gz
cmake: align dir watch backend detection with autotools
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66257
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CMakeLists.txt23
-rw-r--r--cmake/bus/CMakeLists.txt17
2 files changed, 33 insertions, 7 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 6c17461f..45d90c99 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -267,6 +267,27 @@ if(NOT MSVC)
endif(DBUS_GCOV_ENABLED)
endif(NOT MSVC)
+if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+ option (DBUS_BUS_ENABLE_INOTIFY "build with inotify support (linux only)" ON)
+ if(DBUS_BUS_ENABLE_INOTIFY)
+ check_include_file(sys/inotify.h HAVE_SYS_INOTIFY_H)
+ if(NOT HAVE_SYS_INOTIFY_H)
+ message(FATAL_ERROR "sys/inotify.h not found!")
+ endif(NOT HAVE_SYS_INOTIFY_H)
+ endif(DBUS_BUS_ENABLE_INOTIFY)
+elseif("${CMAKE_SYSTEM_NAME}" MATCHES ".*BSD")
+ option (DBUS_BUS_ENABLE_KQUEUE "build with kqueue support (FreeBSD only)" ON)
+ if(DBUS_BUS_ENABLE_KQUEUE)
+ # cmake check a header by compiling a test program with
+ # the header, sys/event.h needs stdint.h and sys/types.h
+ # to work.
+ check_include_files("stdint.h;sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
+ if(NOT HAVE_SYS_EVENT_H)
+ message(FATAL_ERROR "sys/event.h not found!")
+ endif(NOT HAVE_SYS_EVENT_H)
+ endif(DBUS_BUS_ENABLE_KQUEUE)
+endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+
STRING(TOUPPER ${CMAKE_SYSTEM_NAME} sysname)
if("${sysname}" MATCHES ".*SOLARIS.*")
option (HAVE_CONSOLE_OWNER_FILE "enable console owner file (solaris only)" ON)
@@ -511,6 +532,8 @@ message(" Building w/o assertions: ${DBUS_DISABLE_ASSERT} ")
message(" Building w/o checks: ${DBUS_DISABLE_CHECKS} ")
message(" Building bus stats API: ${DBUS_ENABLE_STATS} ")
message(" installing system libs: ${DBUS_INSTALL_SYSTEM_LIBS} ")
+message(" Building inotify support: ${DBUS_BUS_ENABLE_INOTIFY} ")
+message(" Building kqueue support: ${DBUS_BUS_ENABLE_KQUEUE} ")
message(" Building Doxygen docs: ${DBUS_ENABLE_DOXYGEN_DOCS} ")
message(" Building XML docs: ${DBUS_ENABLE_XML_DOCS} ")
message(" Daemon executable name: ${DBUS_DAEMON_NAME}")
diff --git a/cmake/bus/CMakeLists.txt b/cmake/bus/CMakeLists.txt
index f2ea55eb..6fa19f27 100644
--- a/cmake/bus/CMakeLists.txt
+++ b/cmake/bus/CMakeLists.txt
@@ -31,9 +31,13 @@ ENDFOREACH(FILE)
SET (XML_SOURCES ${BUS_DIR}/config-loader-expat.c)
-# after next cvs update
-#set (DIR_WATCH_SOURCE ${BUS_DIR}/dir-watch-default.c)
-set (DIR_WATCH_SOURCE )
+if (DBUS_BUS_ENABLE_INOTIFY)
+ set (DIR_WATCH_SOURCE ${BUS_DIR}/dir-watch-inotify.c)
+elseif (DBUS_BUS_ENABLE_KQUEUE)
+ set (DIR_WATCH_SOURCE ${BUS_DIR}/dir-watch-kqueue.c)
+else (DBUS_BUS_ENABLE_INOTIFY)
+ set (DIR_WATCH_SOURCE ${BUS_DIR}/dir-watch-default.c)
+endif (DBUS_BUS_ENABLE_INOTIFY)
set (BUS_SOURCES
${BUS_DIR}/activation.c
@@ -42,14 +46,13 @@ set (BUS_SOURCES
${BUS_DIR}/bus.h
${BUS_DIR}/config-parser.c
${BUS_DIR}/config-parser.h
- ${BUS_DIR}/config-parser-common.c
- ${BUS_DIR}/config-parser-common.h
+ ${BUS_DIR}/config-parser-common.c
+ ${BUS_DIR}/config-parser-common.h
# ${BUS_DIR}/config-parser-trivial.c
${BUS_DIR}/connection.c
${BUS_DIR}/connection.h
${BUS_DIR}/desktop-file.c
${BUS_DIR}/desktop-file.h
- ${BUS_DIR}/dir-watch-default.c
${BUS_DIR}/dir-watch.h
${BUS_DIR}/dispatch.c
${BUS_DIR}/dispatch.h
@@ -77,7 +80,7 @@ if(DBUS_ENABLE_STATS)
${BUS_DIR}/stats.c
${BUS_DIR}/stats.h
)
-endif()
+endif(DBUS_ENABLE_STATS)
include_directories(${XML_INCLUDE_DIR})