summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2014-01-27 08:54:27 +0100
committerRalf Habacker <ralf.habacker@freenet.de>2014-01-30 17:09:41 +0100
commitea1884e3e5c30c681e1935476b4701166c43125c (patch)
tree0609c73719ffe50c9b187ee32758bae8a9475549 /cmake
parentfb84b3e592f14c3f25a9a04ab1a6262819a415f4 (diff)
downloaddbus-ea1884e3e5c30c681e1935476b4701166c43125c.tar.gz
Keep cmake generated shared dbus-1 library file name in sync with autotools.
Autotools uses a versioned shared library name derived from libtool. This patch adds a versioned shared library name to cmake builds for all supported platforms. Binary compatibility for clients build against older cmake generated binary packages of dbus is provided; on unix like os with symbolic links and on Windows with a copy of the shared library. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=74117 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CMakeLists.txt1
-rw-r--r--cmake/dbus/CMakeLists.txt16
-rw-r--r--cmake/modules/MacrosAutotools.cmake7
3 files changed, 22 insertions, 2 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index b7c25299..41882d73 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -136,7 +136,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 a5481b78..4a15f8c9 100644
--- a/cmake/dbus/CMakeLists.txt
+++ b/cmake/dbus/CMakeLists.txt
@@ -261,13 +261,29 @@ add_library(dbus-1 SHARED
${libdbus_SOURCES}
${libdbus_HEADERS}
)
+if(DBUS_LIBRARY_REVISION)
+ math(EXPR DBUS_LIBRARY_MAJOR "${DBUS_LIBRARY_CURRENT} - ${DBUS_LIBRARY_AGE}")
+endif()
+
if(WIN32)
+ if(DBUS_LIBRARY_REVISION)
+ get_target_property(LEGACY_FILE_NAME dbus-1 LOCATION)
+ set_target_properties(dbus-1 PROPERTIES SUFFIX "-${DBUS_LIBRARY_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ add_custom_command(TARGET dbus-1 POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:dbus-1>" "${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)
target_link_libraries(dbus-1 ws2_32 advapi32 netapi32 iphlpapi)
endif(WINCE)
else(WIN32)
+ if(DBUS_LIBRARY_REVISION)
+ 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)
endif(WIN32)
diff --git a/cmake/modules/MacrosAutotools.cmake b/cmake/modules/MacrosAutotools.cmake
index 68e8ae51..2b1c59d4 100644
--- a/cmake/modules/MacrosAutotools.cmake
+++ b/cmake/modules/MacrosAutotools.cmake
@@ -10,6 +10,9 @@
# ${prefix}_MAJOR_VERSION
# ${prefix}_MINOR_VERSION
# ${prefix}_MICRO_VERSION
+# ${prefix}_LIBRARY_AGE
+# ${prefix}_LIBRARY_REVISION
+# ${prefix}_LIBRARY_CURRENT
#
macro(autoversion config prefix)
file (READ ${config} _configure_ac)
@@ -19,7 +22,9 @@ 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_AGE=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_AGE ${_configure_ac})
+ string (REGEX REPLACE ".*LT_CURRENT=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_CURRENT ${_configure_ac})
+ string (REGEX REPLACE ".*LT_REVISION=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_REVISION ${_configure_ac})
endmacro()
#