From 6ec23c98bd5e6b6ca3dad9d5da5a46e83419f5bb Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 5 Jan 2017 21:47:10 +0100 Subject: Add soversion to library files to generate proper symlinks As mentioned in https://github.com/TokTok/c-toxcore/issues/359#issuecomment-270710463 the current CMake build does not generate version symlinks for library .so files. This is because the version is not specified for library targets. See - https://cmake.org/cmake/help/v3.0/prop_tgt/SOVERSION.html#prop_tgt:SOVERSION - https://cmake.org/cmake/help/v3.0/prop_tgt/VERSION.html#prop_tgt:VERSION Use PROJECT_VERSION_MAJOR and MINOR for SOVERSION because api may break from 0.1 to 0.2 in the 0.x release cycle. --- cmake/ModulePackage.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/ModulePackage.cmake b/cmake/ModulePackage.cmake index 613633ba..f6e7e31a 100644 --- a/cmake/ModulePackage.cmake +++ b/cmake/ModulePackage.cmake @@ -54,7 +54,13 @@ function(add_module lib) if(ENABLE_SHARED) add_library(${lib}_shared SHARED ${ARGN}) - set_target_properties(${lib}_shared PROPERTIES OUTPUT_NAME ${lib}) + set_target_properties(${lib}_shared PROPERTIES + OUTPUT_NAME ${lib} + VERSION ${PROJECT_VERSION} + # While on 0.x, the x behaves like the major version. 0.2 will be + # incompatible with 0.1. Change this, when releasing 1.0! + SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + ) install(TARGETS ${lib}_shared DESTINATION "lib") endif() if(ENABLE_STATIC) -- cgit v1.2.3