From fd7a04788d4b8c5978335fe1d757966442105c62 Mon Sep 17 00:00:00 2001
From: "Ankur Sinha (Ankur Sinha Gmail)" <sanjay.ankur@gmail.com>
Date: Wed, 19 Aug 2020 11:29:07 +0100
Subject: [PATCH 4/8] Set soversions for libs
---
CMakeLists.txt | 5 +++++
src/nrniv/CMakeLists.txt | 7 ++++---
src/nrnpython/CMakeLists.txt | 8 ++++++--
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c35d9b26..e4d58bd7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -603,6 +603,11 @@ if(MINGW)
install(PROGRAMS ${BASH_EXE} DESTINATION ${CMAKE_INSTALL_PREFIX}/mingw/usr/bin)
endif()
+# set up libdir
+if(NOT DEFINED LIB_INSTALL_DIR)
+ set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
+endif()
+
# =============================================================================
# Installation steps for backward compatibility
# =============================================================================
diff --git a/src/nrniv/CMakeLists.txt b/src/nrniv/CMakeLists.txt
index 9adacd4d..9a0376e4 100644
--- a/src/nrniv/CMakeLists.txt
+++ b/src/nrniv/CMakeLists.txt
@@ -295,6 +295,7 @@ else()
elseif(TERMCAP_FOUND)
target_link_libraries(nrniv_lib ${TERMCAP_LIBRARIES})
endif()
+ set_target_properties(nrniv_lib PROPERTIES SOVERSION 0.0.0)
endif()
set_property(TARGET nrniv_lib PROPERTY OUTPUT_NAME nrniv)
@@ -330,7 +331,7 @@ if(NRN_ENABLE_MPI)
target_link_libraries(${libname}_lib nrniv_lib)
endif()
set_property(TARGET ${libname}_lib PROPERTY OUTPUT_NAME ${libname})
- install(TARGETS ${libname}_lib DESTINATION ${NRN_INSTALL_SHARE_LIB_DIR})
+ install(TARGETS ${libname}_lib DESTINATION ${LIB_INSTALL_DIR})
endforeach(val)
else()
target_link_libraries(nrniv_lib ${MPI_C_LIBRARIES})
@@ -404,9 +405,9 @@ endif()
# expected when ctypes looks for dlls
# ~~~
install(TARGETS nrniv nocmodl modlunit DESTINATION bin)
-install(TARGETS nrniv_lib DESTINATION ${NRN_INSTALL_SHARE_LIB_DIR})
+install(TARGETS nrniv_lib DESTINATION ${LIB_INSTALL_DIR})
if (LIBIVX11DYNAM_NAME)
- install(FILES ${PROJECT_BINARY_DIR}/lib/${LIBIVX11DYNAM_NAME} DESTINATION lib)
+ install(FILES ${PROJECT_BINARY_DIR}/lib/${LIBIVX11DYNAM_NAME} DESTINATION ${LIB_INSTALL_DIR})
endif()
# =============================================================================
diff --git a/src/nrnpython/CMakeLists.txt b/src/nrnpython/CMakeLists.txt
index 81813107..d262d261 100644
--- a/src/nrnpython/CMakeLists.txt
+++ b/src/nrnpython/CMakeLists.txt
@@ -89,7 +89,10 @@ endif()
# rxdmath libraries (always build)
add_library(rxdmath SHARED ${CMAKE_CURRENT_SOURCE_DIR}/rxdmath.c)
-install(TARGETS rxdmath DESTINATION ${NRN_INSTALL_SHARE_LIB_DIR})
+if(NOT NRN_WINDOWS_BUILD)
+ set_target_properties(rxdmath PROPERTIES SOVERSION 0.0.0)
+endif()
+install(TARGETS rxdmath DESTINATION ${LIB_INSTALL_DIR})
# =============================================================================
# nrnpython libraries (one lib per python)
@@ -141,10 +144,11 @@ if(NRN_ENABLE_PYTHON_DYNAMIC)
# build python3 library and install it
if(NRNPYTHON_INCLUDE3)
add_library(nrnpython3 SHARED ${NRN_NRNPYTHON_SRC_FILES})
+ set_target_properties(nrnpython3 PROPERTIES SOVERSION 0.0.0)
add_dependencies(nrnpython3 nrniv_lib)
list(APPEND nrnpython_lib_list nrnpython3)
target_include_directories(nrnpython3 BEFORE PUBLIC ${NRNPYTHON_INCLUDE3} ${INCLUDE_DIRS})
- install(TARGETS nrnpython3 DESTINATION ${NRN_INSTALL_SHARE_LIB_DIR})
+ install(TARGETS nrnpython3 DESTINATION ${LIB_INSTALL_DIR})
endif()
endif()
endif()
--
2.35.1