Commit ea1884e3 authored by Ralf Habacker's avatar Ralf Habacker

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=74117Reviewed-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent fb84b3e5
...@@ -136,7 +136,6 @@ if(VCS) ...@@ -136,7 +136,6 @@ if(VCS)
endif(VCS) endif(VCS)
if(WIN32) if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
if(MSVC) if(MSVC)
# controll folders in msvc projects # controll folders in msvc projects
include(ProjectSourceGroup) include(ProjectSourceGroup)
......
...@@ -261,13 +261,29 @@ add_library(dbus-1 SHARED ...@@ -261,13 +261,29 @@ add_library(dbus-1 SHARED
${libdbus_SOURCES} ${libdbus_SOURCES}
${libdbus_HEADERS} ${libdbus_HEADERS}
) )
if(DBUS_LIBRARY_REVISION)
math(EXPR DBUS_LIBRARY_MAJOR "${DBUS_LIBRARY_CURRENT} - ${DBUS_LIBRARY_AGE}")
endif()
if(WIN32) 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) if(WINCE)
target_link_libraries(dbus-1 ws2) target_link_libraries(dbus-1 ws2)
else(WINCE) else(WINCE)
target_link_libraries(dbus-1 ws2_32 advapi32 netapi32 iphlpapi) target_link_libraries(dbus-1 ws2_32 advapi32 netapi32 iphlpapi)
endif(WINCE) endif(WINCE)
else(WIN32) 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) target_link_libraries(dbus-1 ${CMAKE_THREAD_LIBS_INIT} rt)
endif(WIN32) endif(WIN32)
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
# ${prefix}_MAJOR_VERSION # ${prefix}_MAJOR_VERSION
# ${prefix}_MINOR_VERSION # ${prefix}_MINOR_VERSION
# ${prefix}_MICRO_VERSION # ${prefix}_MICRO_VERSION
# ${prefix}_LIBRARY_AGE
# ${prefix}_LIBRARY_REVISION
# ${prefix}_LIBRARY_CURRENT
# #
macro(autoversion config prefix) macro(autoversion config prefix)
file (READ ${config} _configure_ac) file (READ ${config} _configure_ac)
...@@ -19,7 +22,9 @@ macro(autoversion config prefix) ...@@ -19,7 +22,9 @@ macro(autoversion config prefix)
string (REGEX REPLACE ".*${prefix}_micro_version], .([0-9]+).*" "\\1" ${prefix_upper}_MICRO_VERSION ${_configure_ac}) 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 ${${prefix_upper}_MAJOR_VERSION}.${${prefix_upper}_MINOR_VERSION}.${${prefix_upper}_MICRO_VERSION})
set (${prefix_upper}_VERSION_STRING "${${prefix_upper}_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() endmacro()
# #
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment