diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2017-03-03 11:39:23 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2017-03-20 14:18:45 +0000 |
commit | d160c1a71acc157613a5fc4e1ff315d1607f66ff (patch) | |
tree | a7c49a939ade289aae5de6ba3a8a9c2c726762a6 /README.cmake | |
parent | 216627825dd6fd5675b4c521b8b67b7850d7ad4c (diff) | |
download | dbus-d160c1a71acc157613a5fc4e1ff315d1607f66ff.tar.gz dbus-d160c1a71acc157613a5fc4e1ff315d1607f66ff.tar.bz2 dbus-d160c1a71acc157613a5fc4e1ff315d1607f66ff.zip |
cmake, autotools: Add find package config support for cmake clients
With this support cmake and autotools generates cmake equivalent of
pkgconfig files on configure time named DBus1Config*.cmake. These
files are installed into the related directory where cmake expects
find_package related config files.
For instructions how to use this feature with clients see readme.cmake.
With previous DBus versions each cmake client using DBus as dependency
needed a related FindDBus*.cmake in its source distribution or in
the cmake binary packages. With the 'config' find package style support
provided by this patch this requirement has been removed.
The generated config file uses pkgconfig on unix or autotools to
fetch package build flags, which is the prefered way. On Windows
we do not want to require CMake users to have pkg-config installed
so it uses cmake buildin target export support for exporting all
targets into DBus1ConfigTargets*.cmake.
[smcv: make sure variable substitution works in Autotools too]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99721
Reviewed-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'README.cmake')
-rw-r--r-- | README.cmake | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/README.cmake b/README.cmake index 55427df7..facfaf09 100644 --- a/README.cmake +++ b/README.cmake @@ -2,7 +2,7 @@ This file describes how to compile dbus using the cmake build system Requirements ------------ -- cmake version >= 2.4.4 see http://www.cmake.org +- cmake version >= 2.6.0 see http://www.cmake.org - installed libexpat see http://sourceforge.net/projects/expat/ unsupported RelWithDebInfo builds could be fetched from http://sourceforge.net/projects/kde-windows/files/expat/ @@ -171,3 +171,27 @@ Note: The above mentioned options could be extracted after configuring from the output of running "<maketool> help-options" in the build directory. The related entries start with CMAKE_ or DBUS_. + + +How to compile in dbus into clients with cmake +---------------------------------------------- + +To compile dbus library into a client application with cmake +the following cmake commands are required: + +1. call find_package to find dbus package + +find_package(DBus1) + +2. after specifing targets link dbus into target + +add_executable(test test.c) +target_link_libraries(test ${DBus1_LIBRARIES}) + +Adding ${DBus1_LIBRARIES} to targets also adds required dbus +include dirs and compiler definitions by default. There is +no need to add them with include_directories and add_definitions. + +To compile against dbus installed in a non standard location +specify -DDBus1_DIR=<dbus-install-root>/lib[64]/cmake/DBus1 +on cmake command line. |