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 ###############
50 include(GNUInstallDirs)
53 set(DBUS_INSTALL_DIR "${DBUSDIR}")
56 set(DBUS_INSTALL_DIR "$ENV{DBUSDIR}")
60 set(CMAKE_INSTALL_PREFIX "${DBUS_INSTALL_DIR}" CACHE PATH "install prefix" FORCE)
61 else (DBUS_INSTALL_DIR)
62 set(DBUS_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
63 endif (DBUS_INSTALL_DIR)
65 set(DBUS_PREFIX ${DBUS_INSTALL_DIR})
67 set(prefix ${DBUS_INSTALL_DIR})
68 set(exec_prefix ${prefix})
69 set(DBUS_MACHINE_UUID_FILE ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/dbus/machine-id)
70 set(DBUS_BINDIR ${CMAKE_INSTALL_FULL_BINDIR})
71 set(DBUS_DAEMONDIR ${CMAKE_INSTALL_FULL_BINDIR})
72 set(DBUS_LOCALSTATEDIR ${CMAKE_INSTALL_FULL_LOCALSTATEDIR})
73 set(DBUS_RUNSTATEDIR ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run)
75 # On Windows this is relative to where we put the bus setup, in
76 # ${datadir}/dbus-1. For simplicity, we only do this if
77 # ${sysconfdir} = ${prefix}/etc and ${datadir} = ${prefix}/share.
79 # On Unix, or on Windows with weird install layouts, it's the absolute path.
80 if(WIN32 AND ${CMAKE_INSTALL_FULL_SYSCONFDIR} STREQUAL ${prefix}/etc AND ${CMAKE_INSTALL_FULL_DATADIR} STREQUAL ${prefix}/share)
81 set(SYSCONFDIR_FROM_PKGDATADIR ../../etc)
82 set(DATADIR_FROM_PKGSYSCONFDIR ../../share)
84 set(SYSCONFDIR_FROM_PKGDATADIR ${CMAKE_INSTALL_FULL_SYSCONFDIR})
85 set(DATADIR_FROM_PKGSYSCONFDIR ${CMAKE_INSTALL_FULL_DATADIR})
88 option (DBUS_RELOCATABLE "Attempt to make metadata relocatable" ON)
90 # For simplicity, we're not relocatable if CMAKE_INSTALL_LIBDIR
91 # is something more complicated (e.g. Debian multiarch);
92 # we don't want to have to compute how many ../ to add
93 if(CMAKE_INSTALL_LIBDIR STREQUAL "lib" OR CMAKE_INSTALL_LIBDIR STREQUAL "lib64")
94 # We know we can use ../ to get to the prefix. Do nothing.
95 elseif(DBUS_RELOCATABLE)
96 # Sorry, it's too hard to make this particular build relocatable
97 message("Unusual CMAKE_INSTALL_LIBDIR: the generated package will not be relocatable.")
98 set(DBUS_RELOCATABLE OFF)
102 set(DBUS_LIBEXECDIR ${CMAKE_INSTALL_FULL_LIBEXECDIR})
103 set(DBUS_DATADIR ${CMAKE_INSTALL_FULL_DATADIR})
105 #enable building of shared library
106 SET(BUILD_SHARED_LIBS ON)
108 set(INSTALL_TARGETS_DEFAULT_ARGS EXPORT DBus1Targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
114 # search for required packages
116 # include local header first to avoid using old installed header
117 set (CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/..)
118 find_package(LibIconv)
120 addExplorerWrapper(${CMAKE_PROJECT_NAME})
124 option (DBUS_ENABLE_ABSTRACT_SOCKETS "enable support for abstract sockets" ON)
125 set (CMAKE_THREAD_PREFER_PTHREAD ON)
126 include (FindThreads)
129 option (DBUS_DISABLE_ASSERT "Disable assertion checking" OFF)
131 option (DBUS_ENABLE_STATS "enable bus daemon usage statistics" OFF)
134 set(FD_SETSIZE "8192" CACHE STRING "The maximum number of connections that can be handled at once")
140 find_package(GObject)
141 if(GLIB2_FOUND AND GOBJECT_FOUND)
142 option (DBUS_WITH_GLIB "build with glib" ON)
145 # analogous to AC_USE_SYSTEM_EXTENSIONS in configure.ac
146 add_definitions(-D_GNU_SOURCE)
149 INCLUDE(ConfigureChecks.cmake)
151 # @TODO: how to remove last dir from ${CMAKE_SOURCE_DIR} ?
152 SET(DBUS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/..)
154 # make some more macros available
155 include (MacroLibrary)
158 set(DBUS_VERBOSE_C_S 1 CACHE STRING "verbose mode" FORCE)
162 # controll folders in msvc projects
163 include(ProjectSourceGroup)
165 #set(GROUP_CODE split) #cmake default
167 endif(NOT GROUP_CODE)
168 ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
169 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /FIconfig.h")
170 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /FIconfig.h")
177 # Use the highest warning level
179 set(WALL 1 CACHE STRING "all warnings" FORCE)
180 set(CMAKE_CXX_WARNING_LEVEL 4 CACHE STRING "warning level" FORCE)
181 if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
182 string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
184 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
187 if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
188 string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
190 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
193 set(CMAKE_CXX_WARNING_LEVEL 3 CACHE STRING "warning level" FORCE)
196 # see https://msdn.microsoft.com/en-us/library/z78503e6.aspx
197 # 4018 'expression' : signed/unsigned mismatch
199 # 4090 'operation' : different 'modifier' qualifiers
200 # 4101 'identifier' : unreferenced local variable
201 # 4127 conditional expression is constant
202 # 4244 'argument' : conversion from 'type1' to 'type2', possible loss of data
203 set(WARNINGS_DISABLED "4090 4101 4127 4244")
204 # 4002 too many actual parameters for macro 'identifier'
205 # 4003 not enough actual parameters for macro 'identifier'
206 # 4013 'function' undefined; assuming extern returning int
207 # 4028 formal parameter 'number' different from declaration
208 # 4031 second formal parameter list longer than the first list
209 # 4047 operator' : 'identifier1' differs in levels of indirection from 'identifier2'
210 # 4114 same type qualifier used more than once
211 # 4133 'type' : incompatible types - from 'type1' to 'type2'
212 set(WARNINGS_ERRORS "4002 4003 4013 4028 4031 4047 4114 4133")
214 set(WARNINGS "sign-compare")
215 set(WARNINGS_DISABLED "")
216 set(WARNINGS_ERRORS "")
218 generate_warning_cflags(WARNINGS_CFLAGS "${WARNINGS}" "${WARNINGS_DISABLED}" "${WARNINGS_ERRORS}")
219 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNINGS_CFLAGS}")
220 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS_CFLAGS}")
223 if (UNIX AND NOT DBUS_DISABLE_ASSERT)
224 # required for backtrace
225 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wl,--export-dynamic")
226 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wl,--export-dynamic")
227 add_definitions(-DDBUS_BUILT_R_DYNAMIC)
228 endif (UNIX AND NOT DBUS_DISABLE_ASSERT)
231 autodefine(GLIB_VERSION_MIN_REQUIRED)
232 autodefine(GLIB_VERSION_MAX_ALLOWED)
235 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
237 #########################################################################
238 # Windows CE (>= 5.0.0)
240 # WinCE support now relies on the presence of platform files, found in cmake/modules/platform
241 # Cmake 2.8.0 doesn't include WinCE platform files by default, but working ones can be found
242 # on CMake's bugtracker :
243 # http://public.kitware.com/Bug/view.php?id=7919
245 # for cmake 2.8.0 get the following patch only :
246 # http://public.kitware.com/Bug/file_download.php?file_id=2944&type=bug
248 # after applying the patch, you can enable the WinCE build by specifying :
249 # cmake [...] -DCMAKE_SYSTEM_NAME=WinCE -DCMAKE_SYSTEM_VERSION=X.XX
250 # (where X.XX is your actual WinCE version, e.g. 5.02 for Windows Mobile 6)
252 # Note that you should have a proper cross-compilation environment set up prior to running
253 # cmake, ie. the PATH, INCLUDE and LIB env vars pointing to your CE SDK/toolchain.
257 MESSAGE("Building for WinCE (${CMAKE_SYSTEM_VERSION})")
260 #########################################################################
265 #########################################################################
266 # Disallow in-source build
267 #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.")
269 # ... and warn in case of an earlier in-source build
270 #set(generatedFileInSourceDir EXISTS ${dbus_SOURCE_DIR}/config.h)
271 #if(${generatedFileInSourceDir})
272 # message(STATUS "config.h exists in your source directory.")
273 #endif(${generatedFileInSourceDir})
274 #########################################################################
277 set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
278 else (WIN32 OR CYGWIN)
279 set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
280 endif (WIN32 OR CYGWIN)
282 set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
284 # for including config.h and for includes like <dir/foo.h>
285 include_directories( ${CMAKE_SOURCE_DIR}/.. ${CMAKE_BINARY_DIR} ${CMAKE_INCLUDE_PATH} )
287 # linker search directories
288 link_directories(${DBUS_LIB_DIR} ${LIBRARY_OUTPUT_PATH} )
289 include_directories( ${CMAKE_LIBRARY_PATH} )
295 ########### command line options ###############
296 # TODO: take check from configure.in
298 option (DBUS_BUILD_TESTS "enable unit test code" ON)
301 set (DBUS_ENABLE_EMBEDDED_TESTS ON)
302 set (DBUS_ENABLE_MODULAR_TESTS ON)
303 add_definitions(-DDBUS_ENABLE_EMBEDDED_TESTS -DDBUS_ENABLE_MODULAR_TESTS)
304 endif(DBUS_BUILD_TESTS)
306 option (DBUS_USE_OUTPUT_DEBUG_STRING "enable win32 debug port for message output" OFF)
307 if(DBUS_USE_OUTPUT_DEBUG_STRING)
308 add_definitions(-DDBUS_USE_OUTPUT_DEBUG_STRING)
309 endif(DBUS_USE_OUTPUT_DEBUG_STRING)
312 # win32 dbus service support - this support is not complete
313 option (DBUS_SERVICE "enable dbus service installer" OFF)
316 option (DBUS_ENABLE_ANSI "enable -ansi -pedantic gcc flags" OFF)
319 add_definitions(-ansi -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -pedantic)
321 add_definitions(-Za -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -W4)
323 endif(DBUS_ENABLE_ANSI)
325 option (DBUS_ENABLE_VERBOSE_MODE "support verbose debug mode" ON)
327 option (DBUS_DISABLE_CHECKS "Disable public API sanity checking" OFF)
330 option (DBUS_GCOV_ENABLED "compile with coverage profiling instrumentation (gcc only)" OFF)
331 if(DBUS_GCOV_ENABLED)
332 add_definitions(-fprofile-arcs -ftest-coverage)
334 ## remove optimization
335 # CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
336 endif(DBUS_GCOV_ENABLED)
339 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
340 option (DBUS_BUS_ENABLE_INOTIFY "build with inotify support (linux only)" ON)
341 if(DBUS_BUS_ENABLE_INOTIFY)
342 if(NOT HAVE_SYS_INOTIFY_H)
343 message(FATAL_ERROR "sys/inotify.h not found!")
344 endif(NOT HAVE_SYS_INOTIFY_H)
345 endif(DBUS_BUS_ENABLE_INOTIFY)
346 elseif("${CMAKE_SYSTEM_NAME}" MATCHES ".*BSD")
347 option (DBUS_BUS_ENABLE_KQUEUE "build with kqueue support (FreeBSD only)" ON)
348 if(DBUS_BUS_ENABLE_KQUEUE)
349 if(NOT HAVE_SYS_EVENT_H)
350 message(FATAL_ERROR "sys/event.h not found!")
351 endif(NOT HAVE_SYS_EVENT_H)
352 endif(DBUS_BUS_ENABLE_KQUEUE)
353 endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
355 STRING(TOUPPER ${CMAKE_SYSTEM_NAME} sysname)
356 if("${sysname}" MATCHES ".*SOLARIS.*")
357 option (HAVE_CONSOLE_OWNER_FILE "enable console owner file (solaris only)" ON)
358 if(HAVE_CONSOLE_OWNER_FILE)
359 set (DBUS_CONSOLE_OWNER_FILE "/dev/console" CACHE STRING "Directory to check for console ownerhip")
360 endif(HAVE_CONSOLE_OWNER_FILE)
361 endif("${sysname}" MATCHES ".*SOLARIS.*")
364 message(FATAL_ERROR "expat not found!")
365 endif(NOT EXPAT_FOUND)
367 # all missing or hardcoded for now
371 set(atomic_int486 OFF)
372 if(CMAKE_COMPILER_IS_GNUCC AND NOT DBUS_ENABLE_ANSI)
373 FIND_PROGRAM(UNAME_EXECUTABLE
375 PATHS /bin /usr/bin /usr/local/bin c:/Programme/MSys/bin d:/Programme/MSys/bin)
378 EXECUTE_PROCESS(COMMAND ${UNAME_EXECUTABLE} "-m"
379 OUTPUT_VARIABLE UNAME_OUTPUT)
381 if("UNAME_OUTPUT" MATCHES "^.*i[0123]86.*$")
383 else("UNAME_OUTPUT" MATCHES "^.*i[0123]86.*$")
384 if("UNAME_OUTPUT" MATCHES "^.*i?86.*$")
386 set(atomic_int_486 ON)
387 endif("UNAME_OUTPUT" MATCHES "^.*i?86.*$")
388 endif("UNAME_OUTPUT" MATCHES "^.*i[0123]86.*$")
389 endif(UNAME_EXECUTABLE)
390 endif(CMAKE_COMPILER_IS_GNUCC AND NOT DBUS_ENABLE_ANSI)
393 option (DBUS_BUILD_X11 "Build with X11 autolaunch support " ON)
398 # follow Automake's naming convention so we can share .in files
399 set (EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
403 if(CMAKE_BUILD_TYPE MATCHES Debug)
406 message(STATUS "Visual Studio: test programs will only work with 'Debug' configuration!")
407 message(STATUS "To run tests with 'Release' configuration use -DCMAKE_BUILD_TYPE=Release")
408 message(STATUS "Add '..\\..\\test\\data' to the command line option of the test programs")
410 else(CMAKE_BUILD_TYPE MATCHES Debug)
411 set(IDE_BIN /Release)
413 message(STATUS "Visual Studio: test programs will only work with 'Release' configuration!")
414 message(STATUS "To run tests with 'Debug' configuration use -DCMAKE_BUILD_TYPE=Debug")
415 message(STATUS "Add '..\\..\\test\\data' to the command line option of the test programs")
417 endif(CMAKE_BUILD_TYPE MATCHES Debug)
418 set (TEST_PATH_FORCE FORCE)
419 FILE(REMOVE ${CMAKE_BINARY_DIR}/data/dbus-1/services)
422 #### Find socket directories
424 if(NOT $ENV{TMPDIR} STREQUAL "")
425 set(DBUS_SESSION_SOCKET_DIR $ENV{TMPDIR})
426 elseif(NOT $ENV{TEMP} STREQUAL "")
427 set(DBUS_SESSION_SOCKET_DIR $ENV{TEMP})
428 elseif(NOT $ENV{TMP} STREQUAL "")
429 set(DBUS_SESSION_SOCKET_DIR $ENV{TMP})
431 set(DBUS_SESSION_SOCKET_DIR /tmp)
435 # Not used on Windows, where there is no system bus
436 set (DBUS_SYSTEM_PID_FILE ${DBUS_RUNSTATEDIR}/dbus/pid)
439 set (DBUS_CONSOLE_AUTH_DIR "")
441 set (DBUS_CONSOLE_AUTH_DIR "/var/run/console/")
444 # This won't work on Windows. It's not meant to - the system bus is
445 # meaningless on Windows anyway.
447 # This has to be suitable for hard-coding in client libraries as well as
448 # in the dbus-daemon's configuration, so it has to be valid to listen on
449 # and also to connect to. If this ever changes, it'll need to be split into
450 # two variables, one for the listening address and one for the connecting
452 set (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "unix:path=${DBUS_RUNSTATEDIR}/dbus/system_bus_socket" CACHE STRING "system bus default address")
455 set (DBUS_SESSION_BUS_LISTEN_ADDRESS "autolaunch:" CACHE STRING "session bus default listening address")
456 set (DBUS_SESSION_BUS_CONNECT_ADDRESS "autolaunch:" CACHE STRING "session bus fallback address for clients")
458 set (DBUS_SYSTEM_CONFIG_FILE "share/dbus-1/system.conf")
459 set (DBUS_SESSION_CONFIG_FILE "share/dbus-1/session.conf")
460 # bus-test expects a non empty string
461 set (DBUS_USER "Administrator")
462 set (DBUS_TEST_USER "guest")
463 set (DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL "<!--<auth>EXTERNAL</auth>-->")
465 set (DBUS_SESSION_BUS_LISTEN_ADDRESS "unix:tmpdir=${DBUS_SESSION_SOCKET_DIR}" CACHE STRING "session bus default listening address")
466 set (DBUS_SESSION_BUS_CONNECT_ADDRESS "autolaunch:" CACHE STRING "session bus fallback address for clients")
468 set (configdir ${sysconfdir}/dbus-1 )
469 set (DBUS_SYSTEM_CONFIG_FILE ${configdir}/system.conf)
470 set (DBUS_SESSION_CONFIG_FILE ${configdir}/session.conf)
471 set (DBUS_USER "messagebus")
472 set (DBUS_TEST_USER "nobody")
473 # For best security, assume that all non-Windows platforms can do
474 # credentials-passing.
475 set (DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL "<auth>EXTERNAL</auth>")
478 set (DBUS_DAEMON_NAME "dbus-daemon" CACHE STRING "The name of the dbus daemon executable")
480 ########### create config.h ###############
482 #include(ConfigureChecks.cmake)
484 # better use flags for gcc
486 set (HAVE_GNUC_VARARGS 1)
489 # compiler definitions
490 add_definitions(-DHAVE_CONFIG_H=1)
491 add_definitions(${DBUS_BUS_CFLAGS})
494 if (DBUS_BUILD_TESTS)
495 # set variables used for the .in files (substituted by configure_file) in test/data:
496 set(DBUS_TEST_EXEC ${EXECUTABLE_OUTPUT_PATH}${IDE_BIN})
497 set(DBUS_TEST_DATA ${CMAKE_BINARY_DIR}/test/data)
498 set(TEST_LAUNCH_HELPER_BINARY ${EXECUTABLE_OUTPUT_PATH}/dbus-daemon-launch-helper-test)
500 set(TEST_SOCKET_DIR ${DBUS_SESSION_SOCKET_DIR})
501 set(TEST_LISTEN "unix:tmpdir=${TEST_SOCKET_DIR}")
504 set (TEST_LISTEN "tcp:host=localhost")
506 endif (DBUS_BUILD_TESTS)
508 set(DBUS_LIBRARIES dbus-1)
509 set(DBUS_INTERNAL_LIBRARIES dbus-internal)
511 set (DBUS_INTERNAL_ADD_LIBRARY_OPTIONS STATIC)
512 set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_COMPILATION")
514 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
517 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-env.bat.cmake ${CMAKE_BINARY_DIR}/bin/dbus-env.bat )
518 install(FILES ${CMAKE_BINARY_DIR}/bin/dbus-env.bat DESTINATION bin)
521 add_definitions(-DHAVE_CONFIG_H=1)
524 # create cmake find_package related files
526 set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/DBus1)
528 configure_file(DBus1Config.cmake.in "${CMAKE_BINARY_DIR}/DBus1Config.cmake" @ONLY)
530 configure_file(DBus1Config.pkgconfig.in "${CMAKE_BINARY_DIR}/DBus1Config.cmake" @ONLY)
532 configure_file(DBus1ConfigVersion.cmake.in "${CMAKE_BINARY_DIR}/DBus1ConfigVersion.cmake" @ONLY)
534 "${CMAKE_BINARY_DIR}/DBus1Config.cmake"
535 "${CMAKE_BINARY_DIR}/DBus1ConfigVersion.cmake"
536 DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev
540 install(EXPORT DBus1Targets DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
543 ########### subdirs ###############
545 add_subdirectory( dbus )
546 add_subdirectory( bus )
547 if (DBUS_BUILD_TESTS)
548 add_subdirectory( test )
549 add_custom_target(check
550 COMMAND ctest -R ^test-.*
552 endif (DBUS_BUILD_TESTS)
553 add_subdirectory( tools )
554 add_subdirectory( doc )
557 OPTION(DBUS_INSTALL_SYSTEM_LIBS "install required system libraries" OFF)
559 MESSAGE("set -DDBUS_INSTALL_SYSTEM_LIBS=1 to install runtime libraries too")
560 MESSAGE("set DBUSDIR (environment or cmake option) to overwrite the default install directory ")
563 GET_FILENAME_COMPONENT(C_COMPILER ${CMAKE_C_COMPILER} NAME)
564 GET_FILENAME_COMPONENT(CXX_COMPILER ${CMAKE_CXX_COMPILER} NAME)
566 message(" D-BUS ${DBUS_VERSION} ")
567 message(" ============= ")
569 message(" install prefix: ${prefix} ")
570 message(" install exec_prefix: ${exec_prefix} ")
571 message(" install libdir: ${CMAKE_INSTALL_FULL_LIBDIR} ")
572 message(" install bindir: ${CMAKE_INSTALL_FULL_BINDIR} ")
573 message(" install sysconfdir: ${CMAKE_INSTALL_FULL_SYSCONFDIR} ")
574 message(" install datadir: ${CMAKE_INSTALL_FULL_DATADIR} ")
575 message(" source code location: ${DBUS_SOURCE_DIR} ")
576 message(" build dir: ${CMAKE_BINARY_DIR} ")
577 message(" c compiler: ${C_COMPILER} ")
578 message(" cflags: ${CMAKE_C_FLAGS} ")
579 message(" cflags debug: ${CMAKE_C_FLAGS_DEBUG} ")
580 message(" cflags release: ${CMAKE_C_FLAGS_RELEASE} ")
581 message(" cxx compiler: ${CXX_COMPILER} ")
582 message(" cxxflags: ${CMAKE_CXX_FLAGS} ")
583 message(" cxxflags debug: ${CMAKE_CXX_FLAGS_DEBUG} ")
584 message(" cxxflags release: ${CMAKE_CXX_FLAGS_RELEASE} ")
585 message(" 64-bit int: ${DBUS_INT64_TYPE} ")
586 message(" 32-bit int: ${DBUS_INT32_TYPE} ")
587 message(" 16-bit int: ${DBUS_INT16_TYPE} ")
588 message(" Doxygen: ${DOXYGEN} ")
589 message(" Docbook Generator: ${DOCBOOK_GENERATOR_NAME} ")
592 message(" gcc coverage profiling: ${DBUS_GCOV_ENABLED} ")
593 message(" Building unit tests: ${DBUS_BUILD_TESTS} ")
594 message(" Building with GLib: ${DBUS_WITH_GLIB} ")
595 message(" Building verbose mode: ${DBUS_ENABLE_VERBOSE_MODE} ")
596 message(" Building w/o assertions: ${DBUS_DISABLE_ASSERT} ")
597 message(" Building w/o checks: ${DBUS_DISABLE_CHECKS} ")
598 message(" Building bus stats API: ${DBUS_ENABLE_STATS} ")
599 message(" installing system libs: ${DBUS_INSTALL_SYSTEM_LIBS} ")
600 message(" Building inotify support: ${DBUS_BUS_ENABLE_INOTIFY} ")
601 message(" Building kqueue support: ${DBUS_BUS_ENABLE_KQUEUE} ")
602 message(" Building Doxygen docs: ${DBUS_ENABLE_DOXYGEN_DOCS} ")
603 message(" Building XML docs: ${DBUS_ENABLE_XML_DOCS} ")
604 message(" Daemon executable name: ${DBUS_DAEMON_NAME}")
606 message(" Session bus listens on: ${DBUS_SESSION_BUS_LISTEN_ADDRESS} ")
607 message(" Session clients connect to: ${DBUS_SESSION_BUS_CONNECT_ADDRESS} ")
609 message(" System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS} ")
610 message(" System bus socket: ${DBUS_SYSTEM_SOCKET} ")
611 message(" System bus PID file: ${DBUS_SYSTEM_PID_FILE} ")
612 message(" System bus user: ${DBUS_USER} ")
613 message(" Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR} ")
614 message(" Console auth dir: ${DBUS_CONSOLE_AUTH_DIR} ")
615 message(" 'make check' socket dir: ${TEST_SOCKET_DIR} ")
617 message(" Test listen address: ${TEST_LISTEN} ")
619 message(" build timestamp: ${DBUS_BUILD_TIMESTAMP} ")
623 if (DBUS_BUILD_TESTS)
624 message("NOTE: building with unit tests increases the size of the installed library and renders it insecure.")
625 endif(DBUS_BUILD_TESTS)
627 if (DBUS_BUILD_TESTS AND DBUS_DISABLE_ASSERT)
628 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)")
629 endif(DBUS_BUILD_TESTS AND DBUS_DISABLE_ASSERT)
631 if (DBUS_GCOV_ENABLED)
632 message("NOTE: building with coverage profiling is definitely for developers only.")
633 endif(DBUS_GCOV_ENABLED)
635 if (DBUS_ENABLE_VERBOSE_MODE)
636 message("NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance.")
637 endif(DBUS_ENABLE_VERBOSE_MODE)
639 if(NOT DBUS_DISABLE_ASSERT)
640 message("NOTE: building with assertions increases library size and decreases performance.")
641 endif(NOT DBUS_DISABLE_ASSERT)
643 if (DBUS_DISABLE_CHECKS)
644 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.")
645 endif(DBUS_DISABLE_CHECKS)
647 foreach(_note ${FOOTNOTES})
653 INCLUDE(modules/CPackInstallConfig.cmake)
655 add_custom_target(help-options
657 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
661 # create pkgconfig file
664 set(PLATFORM_LIBS pthread ${LIBRT})
665 include(FindPkgConfig QUIET)
667 # convert lists of link libraries into -lstdc++ -lm etc..
668 foreach(LIB ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
669 set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}")
671 set(original_prefix "${CMAKE_INSTALL_PREFIX}")
673 set(pkgconfig_prefix "\${pcfiledir}/../../")
675 set(pkgconfig_prefix "\${original_prefix}")
677 set(exec_prefix "\${prefix}")
678 set(bindir "\${prefix}/${CMAKE_INSTALL_BINDIR}")
679 set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
680 set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
681 set(sysconfdir "\${prefix}/${CMAKE_INSTALL_SYSCONFDIR}")
682 set(datadir "\${prefix}/${CMAKE_INSTALL_DATADIR}")
683 set(datarootdir "\${prefix}/${CMAKE_INSTALL_DATADIR}")
684 set(dbus_daemondir "\${prefix}/${CMAKE_INSTALL_BINDIR}")
685 configure_file(../dbus-1.pc.in ${CMAKE_BINARY_DIR}/dbus-1.pc @ONLY)
686 install(FILES ${CMAKE_BINARY_DIR}/dbus-1.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)