This file describes how to compile dbus using the cmake build system Requirements ------------ - 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/ - for generating documentation based on docbook files - xsltproc (provided by the distribution or from http://xmlsoft.org/XSLT/xsltproc2.html) and - docbook dtd and stylesheets (provided by the distribution or from https://sourceforge.net/projects/docbook/) Building -------- Win32 MinGW-w64|32 1. install mingw-w64 from http://sourceforge.net/projects/mingw-w64/ 2. install cmake, libexpat and optional xsltproc and docbook dtd and stylesheets 3. get dbus sources 4. unpack dbus sources into a sub directory (referred as later) 5. mkdir dbus-build 6. cd dbus-build 7. run cmake -G "MinGW Makefiles" [] mingw32-make mingw32-make install Mingw32 cross compile on Linux 2. install cmake, libexpat and optional xsltproc and docbook dtd and stylesheets e.g on openSUSE Leap 15.0: sudo zypper ar -f https://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_15.0/ sudo zypper install mingw32-cross-gcc-c++ mingw32-libexpat-devel libxslt-tools mingw32-docbook_4 mingw32-docbool-xsl-stylesheets 2. get dbus sources 3. unpack dbus sources into a sub directory (referred as later) 4. mkdir dbus-build 5. cd dbus-build 6. run cmake -DCMAKE_TOOLCHAIN_FILE=/cmake/i686-w64-mingw32.cmake \ -DCMAKE_FIND_ROOT_PATH=/usr/i686-w64-mingw32/sysroot/i686-w64-mingw32 \ [] make make install Win32 Microsoft nmake 1. install MSVC 2010 Express Version from http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express 2. install cmake, libexpat and optional xsltproc and docbook dtd and stylesheets 3. get dbus sources 4. unpack dbus sources into a sub directory (referred as later) 5. mkdir dbus-build 6. cd dbus-build 7. run cmake -G "NMake Makefiles" [] nmake nmake install Win32 Visual Studio 2010 Express IDE 1. install MSVC 2010 Express Version from http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express 2. install cmake, libexpat and optional xsltproc and docbook dtd and stylesheets 3. get dbus sources 4. unpack dbus sources into a sub directory (referred as later) 5. mkdir dbus-build 6. cd dbus-build 7. run cmake -G "Visual Studio 10" [] 8a. open IDE with vcexpress dbus.sln 8b. for immediate build run vcexpress dbus.sln /build Win32 Visual Studio 2010 Professional IDE 1. install MSVC 2010 Professional Version 2. install cmake, libexpat and optional xsltproc and docbook dtd and stylesheets 3. get dbus sources 4. unpack dbus sources into a sub directory (referred as later) 5. mkdir dbus-build 6. cd dbus-build 7. run cmake -G "Visual Studio 10" [] 8a. open IDE with devenv dbus.sln 8b. for immediate build run devenv dbus.sln /build Linux 2. install cmake, libexpat and optional xsltproc and docbook dtd and stylesheets 2. get dbus sources 3. unpack dbus sources into a sub directory (referred as later) 4. mkdir dbus-build 5. cd dbus-build 6. run cmake [] make make install For other compilers see cmake --help in the Generators section Configuration flags ------------------- When using the cmake build system the dbus-specific configuration flags that can be given to the cmake program are these (use -D= on command line). The listed values are the defaults (in a typical build - some are platform-specific). // in case cmake is not able to determine the xsltproc executable (optional) XSLTPROC_EXECUTABLE== 2012): // Enable code analyzing for MSVC compiler: /analyze DBUS_MSVC_ANALYZE:BOOL=OFF Note: Above mentioned options starting with DBUS_ or CMAKE_ could be extracted after configuring from the output of running " help-options" in the build directory. 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=/lib[64]/cmake/DBus1 on cmake command line.