From 817a1e65c31c65a81ca2aec3c049402ddf12b300 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Mon, 27 Jan 2014 08:54:27 +0100 Subject: [PATCH] Keep cross compiled shared dbus-1 library file name in sync with autotools. Autotools uses a versioned shared library name derived from LT_REVISION. This patch adds versioned shared library name to cmake for Windows builds including cross compiled. To keep compatibility with legacy clients a non versioned shared library using the old name will be created and installed too. Client applications linking to this version will use the versioned shared library. --- cmake/CMakeLists.txt | 1 - cmake/dbus/CMakeLists.txt | 9 +++++++++ cmake/modules/MacrosAutotools.cmake | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index fd6c525..d0e305d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -132,7 +132,6 @@ if(VCS) endif(VCS) if(WIN32) - set(CMAKE_DEBUG_POSTFIX "d") if(MSVC) # controll folders in msvc projects include(ProjectSourceGroup) diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt index a5481b7..4ea77e8 100644 --- a/cmake/dbus/CMakeLists.txt +++ b/cmake/dbus/CMakeLists.txt @@ -262,6 +262,15 @@ add_library(dbus-1 SHARED ${libdbus_HEADERS} ) if(WIN32) + if(DBUS_LIBRARY_REVISION) + get_target_property(LEGACY_FILE_NAME dbus-1 LOCATION) + set_target_properties(dbus-1 PROPERTIES SUFFIX "-${DBUS_LIBRARY_REVISION}${CMAKE_SHARED_LIBRARY_SUFFIX}") + add_custom_command(TARGET dbus-1 POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "$" "${LEGACY_FILE_NAME}" + COMMENT "Create non versioned dbus-1 library for legacy applications" + ) + install(FILES ${LEGACY_FILE_NAME} DESTINATION bin) + endif() if(WINCE) target_link_libraries(dbus-1 ws2) else(WINCE) diff --git a/cmake/modules/MacrosAutotools.cmake b/cmake/modules/MacrosAutotools.cmake index 68e8ae5..62e9a00 100644 --- a/cmake/modules/MacrosAutotools.cmake +++ b/cmake/modules/MacrosAutotools.cmake @@ -10,6 +10,7 @@ # ${prefix}_MAJOR_VERSION # ${prefix}_MINOR_VERSION # ${prefix}_MICRO_VERSION +# ${prefix}_LIBRARY_REVISION # macro(autoversion config prefix) file (READ ${config} _configure_ac) @@ -19,7 +20,7 @@ macro(autoversion config prefix) string (REGEX REPLACE ".*${prefix}_micro_version], .([0-9]+).*" "\\1" ${prefix_upper}_MICRO_VERSION ${_configure_ac}) set (${prefix_upper}_VERSION ${${prefix_upper}_MAJOR_VERSION}.${${prefix_upper}_MINOR_VERSION}.${${prefix_upper}_MICRO_VERSION}) set (${prefix_upper}_VERSION_STRING "${${prefix_upper}_VERSION}") - + string (REGEX REPLACE ".*LT_REVISION=([0-9]).*" "\\1" ${prefix_upper}_LIBRARY_REVISION ${_configure_ac}) endmacro() # -- 1.8.4