From cba62a888884f2539fb1cd9dbad4f57487d20f15 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 11 Sep 2014 17:59:25 +0100 Subject: [PATCH] Link libdbus-internal to the shared libdbus-1 under CMake, too --- cmake/CMakeLists.txt | 7 ++----- cmake/dbus/CMakeLists.txt | 14 ++++++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index d8a812d..48879fa 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -475,15 +475,12 @@ if (DBUS_BUILD_TESTS) endif (DBUS_BUILD_TESTS) set(DBUS_LIBRARIES dbus-1) -set(DBUS_INTERNAL_LIBRARIES dbus-internal) +set(DBUS_INTERNAL_LIBRARIES dbus-internal dbus-1) # settings for building and using static internal lib # important note: DBUS_INTERNAL_xxxxx_DEFINITIONS must *not* be set when building dbus-1 library set (DBUS_INTERNAL_ADD_LIBRARY_OPTIONS STATIC) -set (DBUS_INTERNAL_LIBRARY_DEFINITIONS "-DDBUS_STATIC_BUILD") -# For now, the CMake build system doesn't support replacing the internal -# main loop with dbus-glib -set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_STATIC_BUILD -DDBUS_COMPILATION") +set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_COMPILATION") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt index a6aaba0..318dfd3 100644 --- a/cmake/dbus/CMakeLists.txt +++ b/cmake/dbus/CMakeLists.txt @@ -283,6 +283,13 @@ else(WIN32) set_target_properties(dbus-1 PROPERTIES VERSION ${DBUS_LIBRARY_MAJOR}.${DBUS_LIBRARY_AGE}.${DBUS_LIBRARY_REVISION} SOVERSION ${DBUS_LIBRARY_MAJOR}) endif() target_link_libraries(dbus-1 ${CMAKE_THREAD_LIBS_INIT} rt) + + # Assume that Linux has -Wl,--version-script and other platforms do not + if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set(SOVERSION ${DBUS_LIBRARY_MAJOR}) + configure_file(${DBUS_DIR}/Version.in ${CMAKE_CURRENT_BINARY_DIR}/Version) + set_target_properties(dbus-1 PROPERTIES LINK_FLAGS -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/Version) + endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") endif(WIN32) install(TARGETS dbus-1 ${INSTALL_TARGETS_DEFAULT_ARGS}) @@ -291,15 +298,10 @@ install_files(/include/dbus FILES ${dbusinclude_HEADERS}) ### Internal library, used for the daemon, tools and tests, compiled statically. add_library(dbus-internal ${DBUS_INTERNAL_ADD_LIBRARY_OPTIONS} - ${DBUS_LIB_SOURCES} - ${DBUS_LIB_HEADERS} - ${DBUS_SHARED_SOURCES} - ${DBUS_SHARED_HEADERS} ${DBUS_UTIL_SOURCES} ${DBUS_UTIL_HEADERS} ) -target_link_libraries(dbus-internal) -set_target_properties(dbus-internal PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_LIBRARY_DEFINITIONS}) +target_link_libraries(dbus-internal dbus-1) if(WIN32) if(WINCE) target_link_libraries(dbus-internal ws2) -- 2.1.0