[daemon-fix] Registering starters: unwanted release_kdbus_name when no error was...
[platform/upstream/dbus.git] / cmake / CMakeLists.txt
index 9bf5923..fe11196 100644 (file)
@@ -19,6 +19,14 @@ autoversion(../configure.ac dbus)
 # used by file version info
 set (DBUS_PATCH_VERSION "0")
 
+# set PACKAGE_... variables
+autopackage(
+    dbus
+    ${DBUS_VERSION_STRING}
+    "http://dbus.freedesktop.org"
+    "https://bugs.freedesktop.org/enter_bug.cgi?product=dbus"
+)
+
 include(Macros)
 TIMESTAMP(DBUS_BUILD_TIMESTAMP)
 
@@ -103,7 +111,7 @@ find_package(EXPAT)
 find_package(X11)
 
 # analogous to AC_USE_SYSTEM_EXTENSIONS in configure.ac
-add_definitions(-D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE)
+add_definitions(-D_GNU_SOURCE)
 
 # do config checks
 INCLUDE(ConfigureChecks.cmake)
@@ -231,7 +239,9 @@ ENABLE_TESTING()
 option (DBUS_BUILD_TESTS "enable unit test code" ON)
  
 if(DBUS_BUILD_TESTS)
-    add_definitions(-DDBUS_BUILD_TESTS -DDBUS_ENABLE_EMBEDDED_TESTS)
+    set (DBUS_ENABLE_EMBEDDED_TESTS ON)
+    set (DBUS_ENABLE_MODULAR_TESTS ON)
+    add_definitions(-DDBUS_ENABLE_EMBEDDED_TESTS -DDBUS_ENABLE_MODULAR_TESTS)
 endif(DBUS_BUILD_TESTS)
 
 option (DBUS_USE_OUTPUT_DEBUG_STRING "enable win32 debug port for message output" OFF)
@@ -267,6 +277,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)
@@ -276,7 +307,7 @@ if("${sysname}" MATCHES ".*SOLARIS.*")
 endif("${sysname}" MATCHES ".*SOLARIS.*")
 
 if(NOT EXPAT_FOUND)
-    message(FATAL "expat not found!")
+    message(FATAL_ERROR "expat not found!")
 endif(NOT EXPAT_FOUND)
 
 SET(XML_LIB "Expat")
@@ -354,7 +385,7 @@ endif (MSVC_IDE)
          else (NOT $ENV{TMP} STREQUAL "")
          if (WIN32)
              #Should never happen, both TMP and TEMP seem always set on Windows
-             message(FATAL "Could not determine a usable temporary directory")
+             message(FATAL_ERROR "Could not determine a usable temporary directory")
          else(WIN32)
             set (DBUS_SESSION_SOCKET_DIR /tmp)
          endif(WIN32)
@@ -447,7 +478,9 @@ set(DBUS_INTERNAL_LIBRARIES dbus-internal)
 # important note: DBUS_INTERNAL_xxxxx_DEFINITIONS must *not* be set when building dbus-1 library
 set (DBUS_INTERNAL_ADD_LIBRARY_OPTIONS STATIC)
 set (DBUS_INTERNAL_LIBRARY_DEFINITIONS "-DDBUS_STATIC_BUILD")
-set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_STATIC_BUILD")
+# For now, the CMake build system doesn't support replacing the internal
+# main loop with dbus-glib
+set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_STATIC_BUILD -DDBUS_COMPILATION -DDBUS_TEST_USE_INTERNAL")
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
 
@@ -511,6 +544,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}")