Blame 0004-Set-soversions-for-libs.patch

dce4b14
From f6483765ba2cf521f19a1dd3f664f00293a176ee Mon Sep 17 00:00:00 2001
b087e1f
From: "Ankur Sinha (Ankur Sinha Gmail)" <sanjay.ankur@gmail.com>
b087e1f
Date: Wed, 19 Aug 2020 11:29:07 +0100
4c00d82
Subject: [PATCH 4/6] Set soversions for libs
b087e1f
b087e1f
---
b087e1f
 CMakeLists.txt               | 5 +++++
b087e1f
 src/nrniv/CMakeLists.txt     | 7 ++++---
b087e1f
 src/nrnpython/CMakeLists.txt | 8 ++++++--
b087e1f
 3 files changed, 15 insertions(+), 5 deletions(-)
b087e1f
b087e1f
diff --git a/CMakeLists.txt b/CMakeLists.txt
b087e1f
index c3c59c87..1738ccbf 100644
b087e1f
--- a/CMakeLists.txt
b087e1f
+++ b/CMakeLists.txt
b087e1f
@@ -451,6 +451,11 @@ if(MINGW)
b087e1f
   install(PROGRAMS ${BASH_EXE} DESTINATION ${CMAKE_INSTALL_PREFIX}/mingw/usr/bin)
b087e1f
 endif()
b087e1f
 
b087e1f
+# set up libdir
b087e1f
+if(NOT DEFINED LIB_INSTALL_DIR)
b087e1f
+    set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
b087e1f
+endif()
b087e1f
+
b087e1f
 # =============================================================================
b087e1f
 # Print build status
b087e1f
 # =============================================================================
b087e1f
diff --git a/src/nrniv/CMakeLists.txt b/src/nrniv/CMakeLists.txt
b087e1f
index 30024d6e..4e48565c 100644
b087e1f
--- a/src/nrniv/CMakeLists.txt
b087e1f
+++ b/src/nrniv/CMakeLists.txt
b087e1f
@@ -266,6 +266,7 @@ else()
b087e1f
   elseif(TERMCAP_FOUND)
b087e1f
     target_link_libraries(nrniv_lib ${TERMCAP_LIBRARIES})
b087e1f
   endif()
b087e1f
+  set_target_properties(nrniv_lib PROPERTIES SOVERSION 0.0.0)
b087e1f
 endif()
b087e1f
 
b087e1f
 set_property(TARGET nrniv_lib PROPERTY OUTPUT_NAME nrniv)
b087e1f
@@ -294,7 +295,7 @@ if(NRN_ENABLE_MPI)
b087e1f
         target_link_libraries(${libname}_lib nrniv_lib)
b087e1f
       endif()
b087e1f
       set_property(TARGET ${libname}_lib PROPERTY OUTPUT_NAME ${libname})
b087e1f
-      install(TARGETS ${libname}_lib DESTINATION ${NRN_INSTALL_SHARE_LIB_DIR})
b087e1f
+      install(TARGETS ${libname}_lib DESTINATION ${LIB_INSTALL_DIR})
b087e1f
     endforeach(val)
b087e1f
   else()
b087e1f
     target_link_libraries(nrniv_lib ${MPI_C_LIBRARIES})
b087e1f
@@ -363,9 +364,9 @@ endif()
b087e1f
 # expected when ctypes looks for dlls
b087e1f
 # ~~~
b087e1f
 install(TARGETS nrniv nocmodl modlunit DESTINATION bin)
b087e1f
-install(TARGETS nrniv_lib DESTINATION ${NRN_INSTALL_SHARE_LIB_DIR})
b087e1f
+install(TARGETS nrniv_lib DESTINATION ${LIB_INSTALL_DIR})
b087e1f
 if (LIBIVX11DYNAM_NAME)
b087e1f
-  install(FILES ${PROJECT_BINARY_DIR}/lib/${LIBIVX11DYNAM_NAME} DESTINATION lib)
b087e1f
+    install(FILES ${PROJECT_BINARY_DIR}/lib/${LIBIVX11DYNAM_NAME} DESTINATION ${LIB_INSTALL_DIR})
b087e1f
 endif()
b087e1f
 
b087e1f
 # =============================================================================
b087e1f
diff --git a/src/nrnpython/CMakeLists.txt b/src/nrnpython/CMakeLists.txt
b087e1f
index f72aec5c..3e2b91fc 100644
b087e1f
--- a/src/nrnpython/CMakeLists.txt
b087e1f
+++ b/src/nrnpython/CMakeLists.txt
b087e1f
@@ -89,7 +89,10 @@ endif()
b087e1f
 
b087e1f
 # rxdmath libraries (always build)
b087e1f
 add_library(rxdmath SHARED ${CMAKE_CURRENT_SOURCE_DIR}/rxdmath.c)
b087e1f
-install(TARGETS rxdmath DESTINATION ${NRN_INSTALL_SHARE_LIB_DIR})
b087e1f
+if(NOT NRN_WINDOWS_BUILD)
b087e1f
+    set_target_properties(rxdmath PROPERTIES SOVERSION 0.0.0)
b087e1f
+endif()
b087e1f
+install(TARGETS rxdmath DESTINATION ${LIB_INSTALL_DIR})
b087e1f
 
b087e1f
 # =============================================================================
b087e1f
 # nrnpython libraries (one lib per python)
b087e1f
@@ -141,10 +144,11 @@ if(NRN_ENABLE_PYTHON_DYNAMIC)
b087e1f
     # build python3 library and install it
b087e1f
     if(NRNPYTHON_INCLUDE3)
b087e1f
       add_library(nrnpython3 SHARED ${NRN_NRNPYTHON_SRC_FILES})
b087e1f
+      set_target_properties(nrnpython3 PROPERTIES SOVERSION 0.0.0)
b087e1f
       add_dependencies(nrnpython3 nrniv_lib)
b087e1f
       list(APPEND nrnpython_lib_list nrnpython3)
b087e1f
       target_include_directories(nrnpython3 BEFORE PUBLIC ${NRNPYTHON_INCLUDE3} ${INCLUDE_DIRS})
b087e1f
-      install(TARGETS nrnpython3 DESTINATION ${NRN_INSTALL_SHARE_LIB_DIR})
b087e1f
+      install(TARGETS nrnpython3 DESTINATION ${LIB_INSTALL_DIR})
b087e1f
     endif()
b087e1f
   endif()
b087e1f
 endif()
b087e1f
-- 
0cc9008
2.28.0
b087e1f