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 3.0.2 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 string(TIMESTAMP DBUS_BUILD_TIMESTAMP "%Y%m%d%H%M" UTC)
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 set (CMAKE_THREAD_PREFER_PTHREAD ON)
125 include (FindThreads)
128 option (DBUS_DISABLE_ASSERT "Disable assertion checking" OFF)
130 option (DBUS_ENABLE_STATS "enable bus daemon usage statistics" OFF)
133 set(FD_SETSIZE "8192" CACHE STRING "The maximum number of connections that can be handled at once")
139 find_package(GObject)
140 if(GLIB2_FOUND AND GOBJECT_FOUND)
141 option (DBUS_WITH_GLIB "build with glib" ON)
144 # analogous to AC_USE_SYSTEM_EXTENSIONS in configure.ac
145 add_definitions(-D_GNU_SOURCE)
148 INCLUDE(ConfigureChecks.cmake)
150 # @TODO: how to remove last dir from ${CMAKE_SOURCE_DIR} ?
151 SET(DBUS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/..)
153 # make some more macros available
154 include (MacroLibrary)
157 set(DBUS_VERBOSE_C_S 1 CACHE STRING "verbose mode" FORCE)
161 # controll folders in msvc projects
162 include(ProjectSourceGroup)
164 #set(GROUP_CODE split) #cmake default
166 endif(NOT GROUP_CODE)
167 ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
168 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /FIconfig.h")
169 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /FIconfig.h")
176 # Use the highest warning level
178 set(WALL 1 CACHE STRING "all warnings" FORCE)
179 set(CMAKE_CXX_WARNING_LEVEL 4 CACHE STRING "warning level" FORCE)
180 if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
181 string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
183 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
186 if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
187 string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
189 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
192 set(CMAKE_CXX_WARNING_LEVEL 3 CACHE STRING "warning level" FORCE)
195 # see https://msdn.microsoft.com/en-us/library/z78503e6.aspx
196 # 4018 'expression' : signed/unsigned mismatch
198 # 4090 'operation' : different 'modifier' qualifiers
199 # 4101 'identifier' : unreferenced local variable
200 # 4127 conditional expression is constant
201 # 4244 'argument' : conversion from 'type1' to 'type2', possible loss of data
202 set(WARNINGS_DISABLED "4090 4101 4127 4244")
203 # 4002 too many actual parameters for macro 'identifier'
204 # 4003 not enough actual parameters for macro 'identifier'
205 # 4013 'function' undefined; assuming extern returning int
206 # 4028 formal parameter 'number' different from declaration
207 # 4031 second formal parameter list longer than the first list
208 # 4047 operator' : 'identifier1' differs in levels of indirection from 'identifier2'
209 # 4114 same type qualifier used more than once
210 # 4133 'type' : incompatible types - from 'type1' to 'type2'
211 set(WARNINGS_ERRORS "4002 4003 4013 4028 4031 4047 4114 4133")
213 set(WARNINGS "sign-compare")
214 set(WARNINGS_DISABLED "")
215 set(WARNINGS_ERRORS "")
217 generate_warning_cflags(WARNINGS_CFLAGS "${WARNINGS}" "${WARNINGS_DISABLED}" "${WARNINGS_ERRORS}")
218 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNINGS_CFLAGS}")
219 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS_CFLAGS}")
222 if (UNIX AND NOT DBUS_DISABLE_ASSERT)
223 # required for backtrace
224 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wl,--export-dynamic")
225 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wl,--export-dynamic")
226 add_definitions(-DDBUS_BUILT_R_DYNAMIC)
227 endif (UNIX AND NOT DBUS_DISABLE_ASSERT)
230 autodefine(GLIB_VERSION_MIN_REQUIRED)
231 autodefine(GLIB_VERSION_MAX_ALLOWED)
234 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
236 #########################################################################
237 # Windows CE (>= 5.0.0)
239 # WinCE support now relies on the presence of platform files, found in cmake/modules/platform
240 # Cmake 2.8.0 doesn't include WinCE platform files by default, but working ones can be found
241 # on CMake's bugtracker :
242 # http://public.kitware.com/Bug/view.php?id=7919
244 # for cmake 2.8.0 get the following patch only :
245 # http://public.kitware.com/Bug/file_download.php?file_id=2944&type=bug
247 # after applying the patch, you can enable the WinCE build by specifying :
248 # cmake [...] -DCMAKE_SYSTEM_NAME=WinCE -DCMAKE_SYSTEM_VERSION=X.XX
249 # (where X.XX is your actual WinCE version, e.g. 5.02 for Windows Mobile 6)
251 # Note that you should have a proper cross-compilation environment set up prior to running
252 # cmake, ie. the PATH, INCLUDE and LIB env vars pointing to your CE SDK/toolchain.
256 MESSAGE("Building for WinCE (${CMAKE_SYSTEM_VERSION})")
259 #########################################################################
264 #########################################################################
265 # Disallow in-source build
266 #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.")
268 # ... and warn in case of an earlier in-source build
269 #set(generatedFileInSourceDir EXISTS ${dbus_SOURCE_DIR}/config.h)
270 #if(${generatedFileInSourceDir})
271 # message(STATUS "config.h exists in your source directory.")
272 #endif(${generatedFileInSourceDir})
273 #########################################################################
276 set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
277 else (WIN32 OR CYGWIN)
278 set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
279 endif (WIN32 OR CYGWIN)
281 set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
283 # for including config.h and for includes like <dir/foo.h>
284 include_directories( ${CMAKE_SOURCE_DIR}/.. ${CMAKE_BINARY_DIR} ${CMAKE_INCLUDE_PATH} )
286 # linker search directories
287 link_directories(${DBUS_LIB_DIR} ${LIBRARY_OUTPUT_PATH} )
288 include_directories( ${CMAKE_LIBRARY_PATH} )
294 ########### command line options ###############
295 # TODO: take check from configure.in
297 option (DBUS_BUILD_TESTS "enable unit test code" ON)
300 set (DBUS_ENABLE_EMBEDDED_TESTS ON)
301 set (DBUS_ENABLE_MODULAR_TESTS ON)
302 add_definitions(-DDBUS_ENABLE_EMBEDDED_TESTS -DDBUS_ENABLE_MODULAR_TESTS)
303 endif(DBUS_BUILD_TESTS)
305 option (DBUS_USE_OUTPUT_DEBUG_STRING "enable win32 debug port for message output" OFF)
306 if(DBUS_USE_OUTPUT_DEBUG_STRING)
307 add_definitions(-DDBUS_USE_OUTPUT_DEBUG_STRING)
308 endif(DBUS_USE_OUTPUT_DEBUG_STRING)
311 # win32 dbus service support - this support is not complete
312 option (DBUS_SERVICE "enable dbus service installer" OFF)
315 option (DBUS_ENABLE_ANSI "enable -ansi -pedantic gcc flags" OFF)
318 add_definitions(-ansi -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -pedantic)
320 add_definitions(-Za -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -W4)
322 endif(DBUS_ENABLE_ANSI)
324 option (DBUS_ENABLE_VERBOSE_MODE "support verbose debug mode" ON)
326 option (DBUS_DISABLE_CHECKS "Disable public API sanity checking" OFF)
329 option (DBUS_GCOV_ENABLED "compile with coverage profiling instrumentation (gcc only)" OFF)
330 if(DBUS_GCOV_ENABLED)
331 add_definitions(-fprofile-arcs -ftest-coverage)
333 ## remove optimization
334 # CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
335 endif(DBUS_GCOV_ENABLED)
338 if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
339 option (DBUS_BUS_ENABLE_INOTIFY "build with inotify support (linux only)" ON)
340 if(DBUS_BUS_ENABLE_INOTIFY)
341 if(NOT HAVE_SYS_INOTIFY_H)
342 message(FATAL_ERROR "sys/inotify.h not found!")
343 endif(NOT HAVE_SYS_INOTIFY_H)
344 endif(DBUS_BUS_ENABLE_INOTIFY)
345 elseif("${CMAKE_SYSTEM_NAME}" MATCHES ".*BSD")
346 option (DBUS_BUS_ENABLE_KQUEUE "build with kqueue support (FreeBSD only)" ON)
347 if(DBUS_BUS_ENABLE_KQUEUE)
348 if(NOT HAVE_SYS_EVENT_H)
349 message(FATAL_ERROR "sys/event.h not found!")
350 endif(NOT HAVE_SYS_EVENT_H)
351 endif(DBUS_BUS_ENABLE_KQUEUE)
352 endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
354 STRING(TOUPPER ${CMAKE_SYSTEM_NAME} sysname)
355 if("${sysname}" MATCHES ".*SOLARIS.*")
356 option (HAVE_CONSOLE_OWNER_FILE "enable console owner file (solaris only)" ON)
357 if(HAVE_CONSOLE_OWNER_FILE)
358 set (DBUS_CONSOLE_OWNER_FILE "/dev/console" CACHE STRING "Directory to check for console ownerhip")
359 endif(HAVE_CONSOLE_OWNER_FILE)
360 endif("${sysname}" MATCHES ".*SOLARIS.*")
363 message(FATAL_ERROR "expat not found!")
364 endif(NOT EXPAT_FOUND)
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)
392 option (DBUS_BUILD_X11 "Build with X11 autolaunch support " ON)
397 # follow Automake's naming convention so we can share .in files
398 set (EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
402 if(CMAKE_BUILD_TYPE MATCHES Debug)
405 message(STATUS "Visual Studio: test programs will only work with 'Debug' configuration!")
406 message(STATUS "To run tests with 'Release' configuration use -DCMAKE_BUILD_TYPE=Release")
407 message(STATUS "Add '..\\..\\test\\data' to the command line option of the test programs")
409 else(CMAKE_BUILD_TYPE MATCHES Debug)
410 set(IDE_BIN /Release)
412 message(STATUS "Visual Studio: test programs will only work with 'Release' configuration!")
413 message(STATUS "To run tests with 'Debug' configuration use -DCMAKE_BUILD_TYPE=Debug")
414 message(STATUS "Add '..\\..\\test\\data' to the command line option of the test programs")
416 endif(CMAKE_BUILD_TYPE MATCHES Debug)
417 set (TEST_PATH_FORCE FORCE)
418 FILE(REMOVE ${CMAKE_BINARY_DIR}/data/dbus-1/services)
421 #### Find socket directories
423 if(NOT $ENV{TMPDIR} STREQUAL "")
424 set(DBUS_SESSION_SOCKET_DIR $ENV{TMPDIR})
425 elseif(NOT $ENV{TEMP} STREQUAL "")
426 set(DBUS_SESSION_SOCKET_DIR $ENV{TEMP})
427 elseif(NOT $ENV{TMP} STREQUAL "")
428 set(DBUS_SESSION_SOCKET_DIR $ENV{TMP})
430 set(DBUS_SESSION_SOCKET_DIR /tmp)
434 # Not used on Windows, where there is no system bus
435 set (DBUS_SYSTEM_PID_FILE ${DBUS_RUNSTATEDIR}/dbus/pid)
437 set (DBUS_CONSOLE_AUTH_DIR "" CACHE STRING "Directory to check for pam_console/pam_foreground flag files, or empty to ignore")
439 # This won't work on Windows. It's not meant to - the system bus is
440 # meaningless on Windows anyway.
442 # This has to be suitable for hard-coding in client libraries as well as
443 # in the dbus-daemon's configuration, so it has to be valid to listen on
444 # and also to connect to. If this ever changes, it'll need to be split into
445 # two variables, one for the listening address and one for the connecting
447 set (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "unix:path=${DBUS_RUNSTATEDIR}/dbus/system_bus_socket" CACHE STRING "system bus default address")
450 set (DBUS_SESSION_BUS_LISTEN_ADDRESS "autolaunch:" CACHE STRING "session bus default listening address")
451 set (DBUS_SESSION_BUS_CONNECT_ADDRESS "autolaunch:" CACHE STRING "session bus fallback address for clients")
453 set (DBUS_SYSTEM_CONFIG_FILE "share/dbus-1/system.conf")
454 set (DBUS_SESSION_CONFIG_FILE "share/dbus-1/session.conf")
455 # bus-test expects a non empty string
456 set (DBUS_USER "Administrator")
457 set (DBUS_TEST_USER "guest")
458 set (DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL "<!--<auth>EXTERNAL</auth>-->")
460 set (DBUS_SESSION_BUS_LISTEN_ADDRESS "unix:tmpdir=${DBUS_SESSION_SOCKET_DIR}" CACHE STRING "session bus default listening address")
461 set (DBUS_SESSION_BUS_CONNECT_ADDRESS "autolaunch:" CACHE STRING "session bus fallback address for clients")
463 set (configdir ${sysconfdir}/dbus-1 )
464 set (DBUS_SYSTEM_CONFIG_FILE ${configdir}/system.conf)
465 set (DBUS_SESSION_CONFIG_FILE ${configdir}/session.conf)
466 set (DBUS_USER "messagebus")
467 set (DBUS_TEST_USER "nobody")
468 # For best security, assume that all non-Windows platforms can do
469 # credentials-passing.
470 set (DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL "<auth>EXTERNAL</auth>")
473 set (DBUS_DAEMON_NAME "dbus-daemon" CACHE STRING "The name of the dbus daemon executable")
475 ########### create config.h ###############
477 #include(ConfigureChecks.cmake)
479 # better use flags for gcc
481 set (HAVE_GNUC_VARARGS 1)
484 # compiler definitions
485 add_definitions(-DHAVE_CONFIG_H=1)
486 add_definitions(${DBUS_BUS_CFLAGS})
489 if (DBUS_BUILD_TESTS)
490 # set variables used for the .in files (substituted by configure_file) in test/data:
491 set(DBUS_TEST_EXEC ${EXECUTABLE_OUTPUT_PATH}${IDE_BIN})
492 set(DBUS_TEST_DATA ${CMAKE_BINARY_DIR}/test/data)
493 set(TEST_LAUNCH_HELPER_BINARY ${EXECUTABLE_OUTPUT_PATH}/dbus-daemon-launch-helper-test)
495 set(TEST_SOCKET_DIR ${DBUS_SESSION_SOCKET_DIR})
496 set(TEST_LISTEN "unix:tmpdir=${TEST_SOCKET_DIR}")
499 set (TEST_LISTEN "tcp:host=localhost")
501 endif (DBUS_BUILD_TESTS)
503 set(DBUS_LIBRARIES dbus-1)
504 set(DBUS_INTERNAL_LIBRARIES dbus-internal)
506 set (DBUS_INTERNAL_ADD_LIBRARY_OPTIONS STATIC)
507 set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_COMPILATION")
509 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
512 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-env.bat.cmake ${CMAKE_BINARY_DIR}/bin/dbus-env.bat )
513 install(FILES ${CMAKE_BINARY_DIR}/bin/dbus-env.bat DESTINATION bin)
516 add_definitions(-DHAVE_CONFIG_H=1)
519 # create cmake find_package related files
521 set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/DBus1)
523 configure_file(DBus1Config.cmake.in "${CMAKE_BINARY_DIR}/DBus1Config.cmake" @ONLY)
525 configure_file(DBus1Config.pkgconfig.in "${CMAKE_BINARY_DIR}/DBus1Config.cmake" @ONLY)
527 configure_file(DBus1ConfigVersion.cmake.in "${CMAKE_BINARY_DIR}/DBus1ConfigVersion.cmake" @ONLY)
529 "${CMAKE_BINARY_DIR}/DBus1Config.cmake"
530 "${CMAKE_BINARY_DIR}/DBus1ConfigVersion.cmake"
531 DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev
535 install(EXPORT DBus1Targets DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
538 ########### subdirs ###############
540 add_subdirectory( dbus )
541 add_subdirectory( bus )
542 if (DBUS_BUILD_TESTS)
543 add_subdirectory( test )
544 add_custom_target(check
545 COMMAND ctest -R ^test-.*
547 endif (DBUS_BUILD_TESTS)
548 add_subdirectory( tools )
549 add_subdirectory( doc )
552 OPTION(DBUS_INSTALL_SYSTEM_LIBS "install required system libraries" OFF)
554 MESSAGE("set -DDBUS_INSTALL_SYSTEM_LIBS=1 to install runtime libraries too")
555 MESSAGE("set DBUSDIR (environment or cmake option) to overwrite the default install directory ")
558 GET_FILENAME_COMPONENT(C_COMPILER ${CMAKE_C_COMPILER} NAME)
559 GET_FILENAME_COMPONENT(CXX_COMPILER ${CMAKE_CXX_COMPILER} NAME)
561 message(" D-BUS ${DBUS_VERSION} ")
562 message(" ============= ")
564 message(" install prefix: ${prefix} ")
565 message(" install exec_prefix: ${exec_prefix} ")
566 message(" install libdir: ${CMAKE_INSTALL_FULL_LIBDIR} ")
567 message(" install bindir: ${CMAKE_INSTALL_FULL_BINDIR} ")
568 message(" install sysconfdir: ${CMAKE_INSTALL_FULL_SYSCONFDIR} ")
569 message(" install datadir: ${CMAKE_INSTALL_FULL_DATADIR} ")
570 message(" source code location: ${DBUS_SOURCE_DIR} ")
571 message(" build dir: ${CMAKE_BINARY_DIR} ")
572 message(" c compiler: ${C_COMPILER} ")
573 message(" cflags: ${CMAKE_C_FLAGS} ")
574 message(" cflags debug: ${CMAKE_C_FLAGS_DEBUG} ")
575 message(" cflags release: ${CMAKE_C_FLAGS_RELEASE} ")
576 message(" cxx compiler: ${CXX_COMPILER} ")
577 message(" cxxflags: ${CMAKE_CXX_FLAGS} ")
578 message(" cxxflags debug: ${CMAKE_CXX_FLAGS_DEBUG} ")
579 message(" cxxflags release: ${CMAKE_CXX_FLAGS_RELEASE} ")
580 message(" 64-bit int: ${DBUS_INT64_TYPE} ")
581 message(" 32-bit int: ${DBUS_INT32_TYPE} ")
582 message(" 16-bit int: ${DBUS_INT16_TYPE} ")
583 message(" Doxygen: ${DOXYGEN} ")
584 message(" Docbook Generator: ${DOCBOOK_GENERATOR_NAME} ")
587 message(" gcc coverage profiling: ${DBUS_GCOV_ENABLED} ")
588 message(" Building unit tests: ${DBUS_BUILD_TESTS} ")
589 message(" Building with GLib: ${DBUS_WITH_GLIB} ")
590 message(" Building verbose mode: ${DBUS_ENABLE_VERBOSE_MODE} ")
591 message(" Building w/o assertions: ${DBUS_DISABLE_ASSERT} ")
592 message(" Building w/o checks: ${DBUS_DISABLE_CHECKS} ")
593 message(" Building bus stats API: ${DBUS_ENABLE_STATS} ")
594 message(" installing system libs: ${DBUS_INSTALL_SYSTEM_LIBS} ")
595 message(" Building inotify support: ${DBUS_BUS_ENABLE_INOTIFY} ")
596 message(" Building kqueue support: ${DBUS_BUS_ENABLE_KQUEUE} ")
597 message(" Building Doxygen docs: ${DBUS_ENABLE_DOXYGEN_DOCS} ")
598 message(" Building XML docs: ${DBUS_ENABLE_XML_DOCS} ")
599 message(" Daemon executable name: ${DBUS_DAEMON_NAME}")
601 message(" Session bus listens on: ${DBUS_SESSION_BUS_LISTEN_ADDRESS} ")
602 message(" Session clients connect to: ${DBUS_SESSION_BUS_CONNECT_ADDRESS} ")
604 message(" System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS} ")
605 message(" System bus socket: ${DBUS_SYSTEM_SOCKET} ")
606 message(" System bus PID file: ${DBUS_SYSTEM_PID_FILE} ")
607 message(" System bus user: ${DBUS_USER} ")
608 message(" Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR} ")
610 if(DBUS_CONSOLE_AUTH_DIR)
611 message(" pam_console auth dir: ${DBUS_CONSOLE_AUTH_DIR} ")
613 message(" pam_console auth dir: (none) ")
616 message(" 'make check' socket dir: ${TEST_SOCKET_DIR} ")
618 message(" Test listen address: ${TEST_LISTEN} ")
620 message(" build timestamp: ${DBUS_BUILD_TIMESTAMP} ")
624 if (DBUS_BUILD_TESTS)
625 message("NOTE: building with unit tests increases the size of the installed library and renders it insecure.")
626 endif(DBUS_BUILD_TESTS)
628 if (DBUS_BUILD_TESTS AND DBUS_DISABLE_ASSERT)
629 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)")
630 endif(DBUS_BUILD_TESTS AND DBUS_DISABLE_ASSERT)
632 if (DBUS_GCOV_ENABLED)
633 message("NOTE: building with coverage profiling is definitely for developers only.")
634 endif(DBUS_GCOV_ENABLED)
636 if (DBUS_ENABLE_VERBOSE_MODE)
637 message("NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance.")
638 endif(DBUS_ENABLE_VERBOSE_MODE)
640 if(NOT DBUS_DISABLE_ASSERT)
641 message("NOTE: building with assertions increases library size and decreases performance.")
642 endif(NOT DBUS_DISABLE_ASSERT)
644 if (DBUS_DISABLE_CHECKS)
645 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.")
646 endif(DBUS_DISABLE_CHECKS)
648 foreach(_note ${FOOTNOTES})
654 INCLUDE(modules/CPackInstallConfig.cmake)
656 add_custom_target(help-options
658 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
662 # create pkgconfig file
665 set(PLATFORM_LIBS pthread ${LIBRT})
666 include(FindPkgConfig QUIET)
668 # convert lists of link libraries into -lstdc++ -lm etc..
669 foreach(LIB ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
670 set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}")
672 set(original_prefix "${CMAKE_INSTALL_PREFIX}")
674 set(pkgconfig_prefix "\${pcfiledir}/../../")
676 set(pkgconfig_prefix "\${original_prefix}")
678 set(exec_prefix "\${prefix}")
679 set(bindir "\${prefix}/${CMAKE_INSTALL_BINDIR}")
680 set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
681 set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
682 set(sysconfdir "\${prefix}/${CMAKE_INSTALL_SYSCONFDIR}")
683 set(datadir "\${prefix}/${CMAKE_INSTALL_DATADIR}")
684 set(datarootdir "\${prefix}/${CMAKE_INSTALL_DATADIR}")
685 set(dbus_daemondir "\${prefix}/${CMAKE_INSTALL_BINDIR}")
686 configure_file(../dbus-1.pc.in ${CMAKE_BINARY_DIR}/dbus-1.pc @ONLY)
687 install(FILES ${CMAKE_BINARY_DIR}/dbus-1.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)