From a2d3364ec7ea425243d91b758cb9d8fc08306c59 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 23 Sep 2021 10:41:25 +0200 Subject: [PATCH] [CMake] add version and soversion to base libraries --- cmake/GetVersion.cmake | 2 ++ cmake/MapnikExport.cmake | 4 ++-- src/CMakeLists.txt | 3 +++ src/json/CMakeLists.txt | 3 +++ src/wkt/CMakeLists.txt | 3 +++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cmake/GetVersion.cmake b/cmake/GetVersion.cmake index 8c512645b..668cbe34d 100644 --- a/cmake/GetVersion.cmake +++ b/cmake/GetVersion.cmake @@ -9,4 +9,6 @@ macro(get_mapnik_version) string(REGEX MATCH "MAPNIK_PATCH_VERSION ([0-9]*)" _ ${VERSION_FILE}) set(MAPNIK_PATCH_VERSION ${CMAKE_MATCH_1}) + + set(MAPNIK_VERSION ${MAPNIK_MAJOR_VERSION}.${MAPNIK_MINOR_VERSION}.${MAPNIK_PATCH_VERSION}) endmacro() diff --git a/cmake/MapnikExport.cmake b/cmake/MapnikExport.cmake index 6f69fb7c9..d7175129a 100644 --- a/cmake/MapnikExport.cmake +++ b/cmake/MapnikExport.cmake @@ -3,8 +3,8 @@ include(CMakePackageConfigHelpers) # export mapnik configuration write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake" - VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMajorVersion + VERSION ${MAPNIK_VERSION} + COMPATIBILITY ExactVersion ) get_property(MAPNIK_UTILITIES GLOBAL PROPERTY MAPNIK_UTILITIES) list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e163aaf34..28acb2735 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -293,6 +293,9 @@ set_target_properties(mapnik PROPERTIES DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" OUTPUT_NAME "mapnik" PREFIX "lib" + VERSION ${MAPNIK_VERSION} + # see https://github.com/mapnik/mapnik/pull/4248#issuecomment-925596509 => ABI compability only with the full version + SOVERSION ${MAPNIK_VERSION} ) if(MSVC) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index 1b9d8bc23..0c334c2a3 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -29,6 +29,9 @@ set_target_properties(json PROPERTIES DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" OUTPUT_NAME "json" PREFIX "libmapnik-" + VERSION ${MAPNIK_VERSION} + # see mapnik target for explanation + SOVERSION ${MAPNIK_VERSION} ) mapnik_install(json) diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index c0033bb98..7b1815705 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -21,6 +21,9 @@ set_target_properties(wkt PROPERTIES DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" OUTPUT_NAME "wkt" PREFIX "libmapnik-" + VERSION ${MAPNIK_VERSION} + # see mapnik target for explanation + SOVERSION ${MAPNIK_VERSION} ) mapnik_install(wkt)