File: soname.patch

package info (click to toggle)
dune-common 2.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,584 kB
  • sloc: cpp: 33,080; sh: 1,544; python: 428; makefile: 17
file content (34 lines) | stat: -rw-r--r-- 1,480 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- a/cmake/modules/DuneMacros.cmake
+++ b/cmake/modules/DuneMacros.cmake
@@ -1019,9 +1019,14 @@
 # More docu can be found at the top of this file.
 macro(dune_add_library basename)
   include(CMakeParseArguments)
-  cmake_parse_arguments(DUNE_LIB "APPEND;NO_EXPORT;OBJECT" "COMPILE_FLAGS"
+  cmake_parse_arguments(DUNE_LIB "APPEND;NO_EXPORT;OBJECT" "COMPILE_FLAGS;SOVERSION"
     "ADD_LIBS;SOURCES" ${ARGN})
   list(APPEND DUNE_LIB_SOURCES ${DUNE_LIB_UNPARSED_ARGUMENTS})
+  if(NOT DUNE_LIB_SOVERSION)
+    # If no explicit version is given, we assume the ABI is not stable and
+    # changes with every release.
+    set(DUNE_LIB_SOVERSION ${ProjectVersion})
+  endif()
   if(DUNE_LIB_OBJECT)
     if(DUNE_LIB_${basename}_SOURCES)
       message(FATAL_ERROR "There is already a library with the name ${basename}, "
@@ -1063,6 +1068,7 @@
     endif()
     # Build library in ${PROJECT_BINARY_DIR}/lib
     set_target_properties(${basename} PROPERTIES
+      SOVERSION ${DUNE_LIB_SOVERSION}
       LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
       ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
 
@@ -1089,6 +1095,7 @@
         #create shared libs
         add_library(${basename}-shared SHARED  ${DUNE_LIB_SOURCES})
         set_target_properties(${basename}-shared PROPERTIES
+          SOVERSION ${DUNE_LIB_SOVERSION}
           OUTPUT_NAME ${basename}
           LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
         # link with specified libraries.