1 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
2 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
4 # we do not need to have WIN32 defined
5 set(CMAKE_LEGACY_CYGWIN_WIN32 0)
9 # we need to be up to date
10 CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
11 if(COMMAND cmake_policy)
12 cmake_policy(SET CMP0003 NEW)
13 endif(COMMAND cmake_policy)
15 if(CMAKE_MAJOR_VERSION GREATER 2)
16 cmake_policy(SET CMP0026 NEW)
17 if (CMAKE_MAJOR_VERSION GREATER 4 OR CMAKE_MINOR_VERSION GREATER 1)
18 cmake_policy(SET CMP0053 NEW)
19 cmake_policy(SET CMP0054 NEW)
24 include(MacrosAutotools)
25 autoinit(../configure.ac)
28 if(EXISTS ../config.h.in)
29 autoheaderchecks(../config.h.in ConfigureChecks.cmake config.h.cmake)
31 message(STATUS "Generate config.h.in with autogen.sh to enable cmake header difference check.")
34 # used by file version info
35 set (DBUS_PATCH_VERSION "0")
37 # set PACKAGE_... variables
40 ${DBUS_VERSION_STRING}
41 "http://dbus.freedesktop.org"
42 "https://bugs.freedesktop.org/enter_bug.cgi?product=dbus"
46 TIMESTAMP(DBUS_BUILD_TIMESTAMP)
48 ########### basic vars ###############
52 set(DBUS_INSTALL_DIR "${DBUSDIR}")
55 set(DBUS_INSTALL_DIR "$ENV{DBUSDIR}")
59 set(CMAKE_INSTALL_PREFIX "${DBUS_INSTALL_DIR}" CACHE PATH "install prefix" FORCE)
60 else (DBUS_INSTALL_DIR)
61 set(DBUS_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
62 endif (DBUS_INSTALL_DIR)
64 set(DBUS_PREFIX ${DBUS_INSTALL_DIR})
66 set(prefix ${DBUS_INSTALL_DIR})
67 set(exec_prefix ${prefix})
68 set(EXPANDED_LIBDIR ${DBUS_INSTALL_DIR}/lib)
69 set(EXPANDED_INCLUDEDIR ${DBUS_INSTALL_DIR}/include)
70 set(EXPANDED_BINDIR ${DBUS_INSTALL_DIR}/bin)
71 set(EXPANDED_SYSCONFDIR ${DBUS_INSTALL_DIR}/etc)
72 set(EXPANDED_LOCALSTATEDIR ${DBUS_INSTALL_DIR}/var)
73 set(EXPANDED_DATADIR ${DBUS_INSTALL_DIR}/share)
74 set(DBUS_MACHINE_UUID_FILE ${DBUS_INSTALL_DIR}/lib/dbus/machine-id)
75 set(DBUS_BINDIR ${EXPANDED_BINDIR})
76 set(DBUS_DAEMONDIR ${EXPANDED_BINDIR})
77 set(DBUS_LOCALSTATEDIR ${EXPANDED_LOCALSTATEDIR})
79 # On Windows this is relative to where we put the bus setup, in
80 # ${datadir}/dbus-1. For simplicity, we only do this if
81 # ${sysconfdir} = ${prefix}/etc and ${datadir} = ${prefix}/share.
83 # On Unix, or on Windows with weird install layouts, it's the absolute path.
84 if(WIN32 AND ${EXPANDED_SYSCONFDIR} STREQUAL ${prefix}/etc AND ${EXPANDED_DATADIR} STREQUAL ${prefix}/share)
85 set(SYSCONFDIR_FROM_PKGDATADIR ../../etc)
86 set(DATADIR_FROM_PKGSYSCONFDIR ../../share)
88 set(SYSCONFDIR_FROM_PKGDATADIR ${EXPANDED_SYSCONFDIR})
89 set(DATADIR_FROM_PKGSYSCONFDIR ${EXPANDED_DATADIR})
93 set(DBUS_LIBEXECDIR ${EXPANDED_LIBDIR})
94 set(DBUS_DATADIR ${EXPANDED_DATADIR})
96 #enable building of shared library
97 SET(BUILD_SHARED_LIBS ON)
100 set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "bin" LIBRARY DESTINATION "lib" ARCHIVE DESTINATION "lib")
102 set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${EXPANDED_LIBDIR}" LIBRARY DESTINATION "${EXPANDED_LIBDIR}" ARCHIVE DESTINATION "${EXPANDED_LIBDIR}")
109 # search for required packages
111 # include local header first to avoid using old installed header
112 set (CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/..)
113 find_package(LibIconv)
115 addExplorerWrapper(${CMAKE_PROJECT_NAME})
119 option (DBUS_ENABLE_ABSTRACT_SOCKETS "enable support for abstract sockets" ON)
120 set (CMAKE_THREAD_PREFER_PTHREAD ON)
121 include (FindThreads)
124 option (DBUS_DISABLE_ASSERT "Disable assertion checking" OFF)
126 option (DBUS_ENABLE_STATS "enable bus daemon usage statistics" OFF)
129 set(FD_SETSIZE "8192" CACHE STRING "The maximum number of connections that can be handled at once")
135 find_package(GObject)
136 if(GLIB2_FOUND AND GOBJECT_FOUND)
137 option (DBUS_WITH_GLIB "build with glib" ON)
140 # analogous to AC_USE_SYSTEM_EXTENSIONS in configure.ac
141 add_definitions(-D_GNU_SOURCE)
144 INCLUDE(ConfigureChecks.cmake)
146 # @TODO: how to remove last dir from ${CMAKE_SOURCE_DIR} ?
147 SET(DBUS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/..)
149 # make some more macros available
150 include (MacroLibrary)
153 set(DBUS_VERBOSE_C_S 1 CACHE STRING "verbose mode" FORCE)
157 # controll folders in msvc projects
158 include(ProjectSourceGroup)
160 #set(GROUP_CODE split) #cmake default
162 endif(NOT GROUP_CODE)
163 ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
164 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /FIconfig.h")
165 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /FIconfig.h")
172 # Use the highest warning level
174 set(WALL 1 CACHE STRING "all warnings" FORCE)
175 set(CMAKE_CXX_WARNING_LEVEL 4 CACHE STRING "warning level" FORCE)
176 if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
177 string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
179 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
182 if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
183 string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
185 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
188 set(CMAKE_CXX_WARNING_LEVEL 3 CACHE STRING "warning level" FORCE)
191 # see https://msdn.microsoft.com/en-us/library/z78503e6.aspx
192 # 4018 'expression' : signed/unsigned mismatch
194 # 4090 'operation' : different 'modifier' qualifiers
195 # 4101 'identifier' : unreferenced local variable
196 # 4127 conditional expression is constant
197 # 4244 'argument' : conversion from 'type1' to 'type2', possible loss of data
198 set(WARNINGS_DISABLED "4090 4101 4127 4244")
199 # 4002 too many actual parameters for macro 'identifier'
200 # 4003 not enough actual parameters for macro 'identifier'
201 # 4013 'function' undefined; assuming extern returning int
202 # 4028 formal parameter 'number' different from declaration
203 # 4031 second formal parameter list longer than the first list
204 # 4047 operator' : 'identifier1' differs in levels of indirection from 'identifier2'
205 # 4114 same type qualifier used more than once
206 # 4133 'type' : incompatible types - from 'type1' to 'type2'
207 set(WARNINGS_ERRORS "4002 4003 4013 4028 4031 4047 4114 4133")
209 autocompilerwarnings(WARNINGS WARNINGS_DISABLED)
210 set(WARNINGS "${WARNINGS} sign-compare")
211 set(WARNINGS_ERRORS "")
213 generate_warning_cflags(WARNINGS_CFLAGS "${WARNINGS}" "${WARNINGS_DISABLED}" "${WARNINGS_ERRORS}")
214 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNINGS_CFLAGS}")
215 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS_CFLAGS}")
218 if (UNIX AND NOT DBUS_DISABLE_ASSERT)
219 # required for backtrace
220 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wl,--export-dynamic")
221 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wl,--export-dynamic")
222 add_definitions(-DDBUS_BUILT_R_DYNAMIC)
223 endif (UNIX AND NOT DBUS_DISABLE_ASSERT)
226 autodefine(GLIB_VERSION_MIN_REQUIRED)
227 autodefine(GLIB_VERSION_MAX_ALLOWED)
230 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
232 #########################################################################
233 # Windows CE (>= 5.0.0)
235 # WinCE support now relies on the presence of platform files, found in cmake/modules/platform
236 # Cmake 2.8.0 doesn't include WinCE platform files by default, but working ones can be found
237 # on CMake's bugtracker :
238 # http://public.kitware.com/Bug/view.php?id=7919
240 # for cmake 2.8.0 get the following patch only :
241 # http://public.kitware.com/Bug/file_download.php?file_id=2944&type=bug
243 # after applying the patch, you can enable the WinCE build by specifying :
244 # cmake [...] -DCMAKE_SYSTEM_NAME=WinCE -DCMAKE_SYSTEM_VERSION=X.XX
245 # (where X.XX is your actual WinCE version, e.g. 5.02 for Windows Mobile 6)
247 # Note that you should have a proper cross-compilation environment set up prior to running
248 # cmake, ie. the PATH, INCLUDE and LIB env vars pointing to your CE SDK/toolchain.
252 MESSAGE("Building for WinCE (${CMAKE_SYSTEM_VERSION})")
255 #########################################################################
260 #########################################################################
261 # Disallow in-source build
262 #macro_ensure_out_of_source_build("dbus requires an out of source build. Please create a separate build directory and run 'cmake path_to_dbus [options]' there.")
264 # ... and warn in case of an earlier in-source build
265 #set(generatedFileInSourceDir EXISTS ${dbus_SOURCE_DIR}/config.h)
266 #if(${generatedFileInSourceDir})
267 # message(STATUS "config.h exists in your source directory.")
268 #endif(${generatedFileInSourceDir})
269 #########################################################################
272 set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
273 else (WIN32 OR CYGWIN)
274 set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
275 endif (WIN32 OR CYGWIN)
277 set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
279 # for including config.h and for includes like <dir/foo.h>
280 include_directories( ${CMAKE_SOURCE_DIR}/.. ${CMAKE_BINARY_DIR} ${CMAKE_INCLUDE_PATH} )
282 # linker search directories
283 link_directories(${DBUS_LIB_DIR} ${LIBRARY_OUTPUT_PATH} )
284 include_directories( ${CMAKE_LIBRARY_PATH} )
290 ########### command line options ###############
291 # TODO: take check from configure.in
293 option (DBUS_BUILD_TESTS "enable unit test code" ON)
296 set (DBUS_ENABLE_EMBEDDED_TESTS ON)
297 set (DBUS_ENABLE_MODULAR_TESTS ON)
298 add_definitions(-DDBUS_ENABLE_EMBEDDED_TESTS -DDBUS_ENABLE_MODULAR_TESTS)
299 endif(DBUS_BUILD_TESTS)
301 option (DBUS_USE_OUTPUT_DEBUG_STRING "enable win32 debug port for message output" OFF)
302 if(DBUS_USE_OUTPUT_DEBUG_STRING)
303 add_definitions(-DDBUS_USE_OUTPUT_DEBUG_STRING)
304 endif(DBUS_USE_OUTPUT_DEBUG_STRING)
307 # win32 dbus service support - this support is not complete
308 option (DBUS_SERVICE "enable dbus service installer" OFF)
311 option (DBUS_ENABLE_ANSI "enable -ansi -pedantic gcc flags" OFF)
314 add_definitions(-ansi -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -pedantic)
316 add_definitions(-Za -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -W4)
318 endif(DBUS_ENABLE_ANSI)
320 option (DBUS_ENABLE_VERBOSE_MODE "support verbose debug mode" ON)
322 option (DBUS_DISABLE_CHECKS "Disable public API sanity checking" OFF)
325 option (DBUS_GCOV_ENABLED "compile with coverage profiling instrumentation (gcc only)" OFF)
326 if(DBUS_GCOV_ENABLED)
327 add_definitions(-fprofile-arcs -ftest-coverage)
329 ## remove optimization
330 # CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
331 endif(DBUS_GCOV_ENABLED)
334 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
335 option (DBUS_BUS_ENABLE_INOTIFY "build with inotify support (linux only)" ON)
336 if(DBUS_BUS_ENABLE_INOTIFY)
337 if(NOT HAVE_SYS_INOTIFY_H)
338 message(FATAL_ERROR "sys/inotify.h not found!")
339 endif(NOT HAVE_SYS_INOTIFY_H)
340 endif(DBUS_BUS_ENABLE_INOTIFY)
341 elseif("${CMAKE_SYSTEM_NAME}" MATCHES ".*BSD")
342 option (DBUS_BUS_ENABLE_KQUEUE "build with kqueue support (FreeBSD only)" ON)
343 if(DBUS_BUS_ENABLE_KQUEUE)
344 if(NOT HAVE_SYS_EVENT_H)
345 message(FATAL_ERROR "sys/event.h not found!")
346 endif(NOT HAVE_SYS_EVENT_H)
347 endif(DBUS_BUS_ENABLE_KQUEUE)
348 endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
350 STRING(TOUPPER ${CMAKE_SYSTEM_NAME} sysname)
351 if("${sysname}" MATCHES ".*SOLARIS.*")
352 option (HAVE_CONSOLE_OWNER_FILE "enable console owner file (solaris only)" ON)
353 if(HAVE_CONSOLE_OWNER_FILE)
354 set (DBUS_CONSOLE_OWNER_FILE "/dev/console" CACHE STRING "Directory to check for console ownerhip")
355 endif(HAVE_CONSOLE_OWNER_FILE)
356 endif("${sysname}" MATCHES ".*SOLARIS.*")
359 message(FATAL_ERROR "expat not found!")
360 endif(NOT EXPAT_FOUND)
363 SET(XML_LIBRARY ${EXPAT_LIBRARIES})
364 SET(XML_INCLUDE_DIR ${EXPAT_INCLUDE_DIR})
366 # all missing or hardcoded for now
370 set(atomic_int486 OFF)
371 if(CMAKE_COMPILER_IS_GNUCC AND NOT DBUS_ENABLE_ANSI)
372 FIND_PROGRAM(UNAME_EXECUTABLE
374 PATHS /bin /usr/bin /usr/local/bin c:/Programme/MSys/bin d:/Programme/MSys/bin)
377 EXECUTE_PROCESS(COMMAND ${UNAME_EXECUTABLE} "-m"
378 OUTPUT_VARIABLE UNAME_OUTPUT)
380 if("UNAME_OUTPUT" MATCHES "^.*i[0123]86.*$")
382 else("UNAME_OUTPUT" MATCHES "^.*i[0123]86.*$")
383 if("UNAME_OUTPUT" MATCHES "^.*i?86.*$")
385 set(atomic_int_486 ON)
386 endif("UNAME_OUTPUT" MATCHES "^.*i?86.*$")
387 endif("UNAME_OUTPUT" MATCHES "^.*i[0123]86.*$")
388 endif(UNAME_EXECUTABLE)
389 endif(CMAKE_COMPILER_IS_GNUCC AND NOT DBUS_ENABLE_ANSI)
391 set (DBUS_HAVE_ATOMIC_INT ${atomic_int} CACHE STRING "Some atomic integer implementation present")
392 set (DBUS_USE_ATOMIC_INT_486 ${atomic_int_486} CACHE STRING "Use atomic integer implementation for 486")
395 option (DBUS_BUILD_X11 "Build with X11 autolaunch support " ON)
400 # follow Automake's naming convention so we can share .in files
401 set (EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
405 if(CMAKE_BUILD_TYPE MATCHES Debug)
408 message(STATUS "Visual Studio: test programs will only work with 'Debug' configuration!")
409 message(STATUS "To run tests with 'Release' configuration use -DCMAKE_BUILD_TYPE=Release")
410 message(STATUS "Add '..\\..\\test\\data' to the command line option of the test programs")
412 else(CMAKE_BUILD_TYPE MATCHES Debug)
413 set(IDE_BIN /Release)
415 message(STATUS "Visual Studio: test programs will only work with 'Release' configuration!")
416 message(STATUS "To run tests with 'Debug' configuration use -DCMAKE_BUILD_TYPE=Debug")
417 message(STATUS "Add '..\\..\\test\\data' to the command line option of the test programs")
419 endif(CMAKE_BUILD_TYPE MATCHES Debug)
420 set (TEST_PATH_FORCE FORCE)
421 FILE(REMOVE ${CMAKE_BINARY_DIR}/data/dbus-1/services)
424 #### Find socket directories
425 if (NOT $ENV{TMPDIR} STREQUAL "")
426 set (DBUS_SESSION_SOCKET_DIR $ENV{TMPDIR})
427 else (NOT $ENV{TMPDIR} STREQUAL "")
428 if (NOT $ENV{TEMP} STREQUAL "")
429 set (DBUS_SESSION_SOCKET_DIR $ENV{TEMP})
430 else (NOT $ENV{TEMP} STREQUAL "")
431 if (NOT $ENV{TMP} STREQUAL "")
432 set (DBUS_SESSION_SOCKET_DIR $ENV{TMP})
433 else (NOT $ENV{TMP} STREQUAL "")
435 #Should never happen, both TMP and TEMP seem always set on Windows
436 message(FATAL_ERROR "Could not determine a usable temporary directory")
438 set (DBUS_SESSION_SOCKET_DIR /tmp)
440 endif (NOT $ENV{TMP} STREQUAL "")
441 endif (NOT $ENV{TEMP} STREQUAL "")
442 endif (NOT $ENV{TMPDIR} STREQUAL "")
444 # Not used on Windows, where there is no system bus
445 set (DBUS_SYSTEM_PID_FILE ${DBUS_LOCALSTATEDIR}/run/dbus/pid)
448 set (DBUS_CONSOLE_AUTH_DIR "")
450 set (DBUS_CONSOLE_AUTH_DIR "/var/run/console/")
453 # This won't work on Windows. It's not meant to - the system bus is
454 # meaningless on Windows anyway.
456 # This has to be suitable for hard-coding in client libraries as well as
457 # in the dbus-daemon's configuration, so it has to be valid to listen on
458 # and also to connect to. If this ever changes, it'll need to be split into
459 # two variables, one for the listening address and one for the connecting
461 set (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "unix:path=${DBUS_LOCALSTATEDIR}/run/dbus/system_bus_socket" CACHE STRING "system bus default address")
464 set (DBUS_SESSION_BUS_LISTEN_ADDRESS "autolaunch:" CACHE STRING "session bus default listening address")
465 set (DBUS_SESSION_BUS_CONNECT_ADDRESS "autolaunch:" CACHE STRING "session bus fallback address for clients")
467 set (DBUS_SYSTEM_CONFIG_FILE "share/dbus-1/system.conf")
468 set (DBUS_SESSION_CONFIG_FILE "share/dbus-1/session.conf")
469 # bus-test expects a non empty string
470 set (DBUS_USER "Administrator")
471 set (DBUS_TEST_USER "guest")
472 set (DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL "<!--<auth>EXTERNAL</auth>-->")
474 set (DBUS_SESSION_BUS_LISTEN_ADDRESS "unix:tmpdir=${DBUS_SESSION_SOCKET_DIR}" CACHE STRING "session bus default listening address")
475 set (DBUS_SESSION_BUS_CONNECT_ADDRESS "autolaunch:" CACHE STRING "session bus fallback address for clients")
477 set (configdir ${sysconfdir}/dbus-1 )
478 set (DBUS_SYSTEM_CONFIG_FILE ${configdir}/system.conf)
479 set (DBUS_SESSION_CONFIG_FILE ${configdir}/session.conf)
480 set (DBUS_USER "messagebus")
481 set (DBUS_TEST_USER "nobody")
482 # For best security, assume that all non-Windows platforms can do
483 # credentials-passing.
484 set (DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL "<auth>EXTERNAL</auth>")
487 set (DBUS_DAEMON_NAME "dbus-daemon" CACHE STRING "The name of the dbus daemon executable")
489 ########### create config.h ###############
491 #include(ConfigureChecks.cmake)
493 # better use flags for gcc
495 set (HAVE_GNUC_VARARGS 1)
498 # compiler definitions
499 add_definitions(-DHAVE_CONFIG_H=1)
500 add_definitions(${DBUS_BUS_CFLAGS})
503 if (DBUS_BUILD_TESTS)
504 # set variables used for the .in files (substituted by configure_file) in test/data:
505 set(DBUS_TEST_EXEC ${EXECUTABLE_OUTPUT_PATH}${IDE_BIN})
506 set(DBUS_TEST_DATA ${CMAKE_BINARY_DIR}/test/data)
507 set(TEST_SOCKET_DIR ${DBUS_SESSION_SOCKET_DIR} )
508 set(TEST_LAUNCH_HELPER_BINARY ${EXECUTABLE_OUTPUT_PATH}/dbus-daemon-launch-helper-test)
510 set (TEST_LISTEN "unix:tmpdir=${TEST_SOCKET_DIR}")
513 set (TEST_LISTEN "tcp:host=localhost")
515 endif (DBUS_BUILD_TESTS)
517 set(DBUS_LIBRARIES dbus-1)
518 set(DBUS_INTERNAL_LIBRARIES dbus-internal)
520 set (DBUS_INTERNAL_ADD_LIBRARY_OPTIONS STATIC)
521 set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_COMPILATION")
523 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
526 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-env.bat.cmake ${CMAKE_BINARY_DIR}/bin/dbus-env.bat )
527 install_files(/bin FILES ${CMAKE_BINARY_DIR}/bin/dbus-env.bat)
530 add_definitions(-DHAVE_CONFIG_H=1)
532 ########### subdirs ###############
534 add_subdirectory( dbus )
535 add_subdirectory( bus )
536 if (DBUS_BUILD_TESTS)
537 add_subdirectory( test )
538 add_custom_target(check
539 COMMAND ctest -R ^test-.*
541 endif (DBUS_BUILD_TESTS)
542 add_subdirectory( tools )
543 add_subdirectory( doc )
546 OPTION(DBUS_INSTALL_SYSTEM_LIBS "install required system libraries" OFF)
548 MESSAGE("set -DDBUS_INSTALL_SYSTEM_LIBS=1 to install runtime libraries too")
549 MESSAGE("set DBUSDIR (environment or cmake option) to overwrite the default install directory ")
552 GET_FILENAME_COMPONENT(C_COMPILER ${CMAKE_C_COMPILER} NAME)
553 GET_FILENAME_COMPONENT(CXX_COMPILER ${CMAKE_CXX_COMPILER} NAME)
555 message(" D-BUS ${DBUS_VERSION} ")
556 message(" ============ ")
558 message(" install prefix: ${prefix} ")
559 message(" install exec_prefix: ${exec_prefix} ")
560 message(" install libdir: ${EXPANDED_LIBDIR} ")
561 message(" install bindir: ${EXPANDED_BINDIR} ")
562 message(" install sysconfdir: ${EXPANDED_SYSCONFDIR} ")
563 message(" install datadir: ${EXPANDED_DATADIR} ")
564 message(" source code location: ${DBUS_SOURCE_DIR} ")
565 message(" build dir: ${CMAKE_BINARY_DIR} ")
566 message(" c compiler: ${C_COMPILER} ")
567 message(" cflags: ${CMAKE_C_FLAGS} ")
568 message(" cflags debug: ${CMAKE_C_FLAGS_DEBUG} ")
569 message(" cflags release: ${CMAKE_C_FLAGS_RELEASE} ")
570 message(" cxx compiler: ${CXX_COMPILER} ")
571 message(" cxxflags: ${CMAKE_CXX_FLAGS} ")
572 message(" cxxflags debug: ${CMAKE_CXX_FLAGS_DEBUG} ")
573 message(" cxxflags release: ${CMAKE_CXX_FLAGS_RELEASE} ")
574 message(" 64-bit int: ${DBUS_INT64_TYPE} ")
575 message(" 32-bit int: ${DBUS_INT32_TYPE} ")
576 message(" 16-bit int: ${DBUS_INT16_TYPE} ")
577 message(" Doxygen: ${DOXYGEN} ")
578 message(" Docbook Generator: ${DOCBOOK_GENERATOR_NAME} ")
581 message(" gcc coverage profiling: ${DBUS_GCOV_ENABLED} ")
582 message(" Building unit tests: ${DBUS_BUILD_TESTS} ")
583 message(" Building with GLib: ${DBUS_WITH_GLIB} ")
584 message(" Building verbose mode: ${DBUS_ENABLE_VERBOSE_MODE} ")
585 message(" Building w/o assertions: ${DBUS_DISABLE_ASSERT} ")
586 message(" Building w/o checks: ${DBUS_DISABLE_CHECKS} ")
587 message(" Building bus stats API: ${DBUS_ENABLE_STATS} ")
588 message(" installing system libs: ${DBUS_INSTALL_SYSTEM_LIBS} ")
589 message(" Building inotify support: ${DBUS_BUS_ENABLE_INOTIFY} ")
590 message(" Building kqueue support: ${DBUS_BUS_ENABLE_KQUEUE} ")
591 message(" Building Doxygen docs: ${DBUS_ENABLE_DOXYGEN_DOCS} ")
592 message(" Building XML docs: ${DBUS_ENABLE_XML_DOCS} ")
593 message(" Daemon executable name: ${DBUS_DAEMON_NAME}")
595 message(" System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS} ")
596 message(" Session bus listens on: ${DBUS_SESSION_BUS_LISTEN_ADDRESS} ")
597 message(" Session clients connect to: ${DBUS_SESSION_BUS_CONNECT_ADDRESS} ")
599 message(" System bus socket: ${DBUS_SYSTEM_SOCKET} ")
600 message(" System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS} ")
601 message(" System bus PID file: ${DBUS_SYSTEM_PID_FILE} ")
602 message(" Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR} ")
603 message(" Console auth dir: ${DBUS_CONSOLE_AUTH_DIR} ")
604 message(" System bus user: ${DBUS_USER} ")
605 message(" 'make check' socket dir: ${TEST_SOCKET_DIR} ")
607 message(" Test listen address: ${TEST_LISTEN} ")
609 message(" build timestamp: ${DBUS_BUILD_TIMESTAMP} ")
613 if (DBUS_BUILD_TESTS)
614 message("NOTE: building with unit tests increases the size of the installed library and renders it insecure.")
615 endif(DBUS_BUILD_TESTS)
617 if (DBUS_BUILD_TESTS AND DBUS_DISABLE_ASSERT)
618 message("NOTE: building with unit tests but without assertions means tests may not properly report failures (this configuration is only useful when doing something like profiling the tests)")
619 endif(DBUS_BUILD_TESTS AND DBUS_DISABLE_ASSERT)
621 if (DBUS_GCOV_ENABLED)
622 message("NOTE: building with coverage profiling is definitely for developers only.")
623 endif(DBUS_GCOV_ENABLED)
625 if (DBUS_ENABLE_VERBOSE_MODE)
626 message("NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance.")
627 endif(DBUS_ENABLE_VERBOSE_MODE)
629 if(NOT DBUS_DISABLE_ASSERT)
630 message("NOTE: building with assertions increases library size and decreases performance.")
631 endif(NOT DBUS_DISABLE_ASSERT)
633 if (DBUS_DISABLE_CHECKS)
634 message("NOTE: building without checks for arguments passed to public API makes it harder to debug apps using D-BUS, but will slightly decrease D-BUS library size and _very_ slightly improve performance.")
635 endif(DBUS_DISABLE_CHECKS)
637 foreach(_note ${FOOTNOTES})
643 INCLUDE(modules/CPackInstallConfig.cmake)
645 add_custom_target(help-options
647 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}