3d7eff6d69
Package-Manager: Portage-3.0.0, Repoman-2.3.23 Signed-off-by: Horea Christian <chr@chymera.eu>
118 lines
4.4 KiB
Diff
118 lines
4.4 KiB
Diff
From 329a7be631b33294d9cf3d58e8cdeb62e0aa993c Mon Sep 17 00:00:00 2001
|
|
From: Philip A Cook <cookpa@pennmedicine.upenn.edu>
|
|
Date: Fri, 26 Jun 2020 18:23:08 +0000
|
|
Subject: [PATCH] ENH: Use GNUInstallDirs CMake module
|
|
|
|
Trying to enable installation to the correct lib dir for each platform
|
|
---
|
|
Common.cmake | 7 +++++--
|
|
Examples/CMakeLists.txt | 32 ++++++++++++++++----------------
|
|
2 files changed, 21 insertions(+), 18 deletions(-)
|
|
|
|
diff --git a/Common.cmake b/Common.cmake
|
|
index 5e52d7f1..1e604113 100644
|
|
--- a/Common.cmake
|
|
+++ b/Common.cmake
|
|
@@ -103,8 +103,6 @@ if(PLATFORM_CHECK)
|
|
endif()
|
|
endif()
|
|
|
|
-
|
|
-
|
|
#-------------------------------------------------------------------------
|
|
# Augment compiler flags
|
|
#-------------------------------------------------------------------------
|
|
@@ -124,3 +122,8 @@ if(NOT CMAKE_POSITION_INDEPENDENT_CODE)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
endif()
|
|
endif()
|
|
+
|
|
+#-------------------------------------------------------------------------
|
|
+# Define install dirs for different platforms
|
|
+#-------------------------------------------------------------------------
|
|
+include(GNUInstallDirs)
|
|
diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt
|
|
index 61781f56..cb352748 100644
|
|
--- a/Examples/CMakeLists.txt
|
|
+++ b/Examples/CMakeLists.txt
|
|
@@ -1,4 +1,4 @@
|
|
-SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
|
+SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
|
## Note that the antsUtilities can always be built static. It will then be linked
|
|
## Directly into the other libraries.
|
|
add_library(antsUtilities antsUtilities.cxx
|
|
@@ -14,11 +14,11 @@ add_library(antsUtilities antsUtilities.cxx
|
|
)
|
|
target_link_libraries(antsUtilities ${ITK_LIBRARIES} )
|
|
install(TARGETS antsUtilities
|
|
- RUNTIME DESTINATION bin
|
|
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
COMPONENT RUNTIME_antsUtilities
|
|
- LIBRARY DESTINATION lib
|
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT RUNTIME_antsUtilities
|
|
- ARCHIVE DESTINATION lib
|
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT DEVELOPMENT_antsUtilities
|
|
)
|
|
|
|
@@ -34,22 +34,22 @@ macro(STATIC_ANTS_BUILD ANTS_FUNCTION_NAME EXTRA_LIBS)
|
|
|
|
if (ANTS_INSTALL_LIBS_ONLY)
|
|
install(TARGETS l_${ANTS_FUNCTION_NAME}
|
|
- # RUNTIME DESTINATION bin
|
|
+ # RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
# COMPONENT RUNTIME_${ANTS_FUNCTION_NAME}
|
|
- LIBRARY DESTINATION lib
|
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT RUNTIME_${ANTS_FUNCTION_NAME}
|
|
- ARCHIVE DESTINATION lib
|
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT DEVELOPMENT_${ANTS_FUNCTION_NAME}
|
|
)
|
|
else()
|
|
add_executable( ${ANTS_FUNCTION_NAME} cli_${ANTS_FUNCTION_NAME}.cxx )
|
|
target_link_libraries( ${ANTS_FUNCTION_NAME} l_${ANTS_FUNCTION_NAME} )
|
|
install(TARGETS l_${ANTS_FUNCTION_NAME} ${ANTS_FUNCTION_NAME}
|
|
- RUNTIME DESTINATION bin
|
|
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
COMPONENT RUNTIME_${ANTS_FUNCTION_NAME}
|
|
- LIBRARY DESTINATION lib
|
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT RUNTIME_${ANTS_FUNCTION_NAME}
|
|
- ARCHIVE DESTINATION lib
|
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT DEVELOPMENT_${ANTS_FUNCTION_NAME}
|
|
)
|
|
endif()
|
|
@@ -68,11 +68,11 @@ macro(DYNAMIC_ANTS_BUILD ANTS_FUNCTION_NAME EXTRA_LIBS)
|
|
|
|
if (ANTS_INSTALL_LIBS_ONLY)
|
|
install(TARGETS l_${ANTS_FUNCTION_NAME}
|
|
- # RUNTIME DESTINATION bin
|
|
+ # RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
# COMPONENT RUNTIME_${ANTS_FUNCTION_NAME}
|
|
- LIBRARY DESTINATION lib
|
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT RUNTIME_${ANTS_FUNCTION_NAME}
|
|
- ARCHIVE DESTINATION lib
|
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT DEVELOPMENT_${ANTS_FUNCTION_NAME}
|
|
)
|
|
else()
|
|
@@ -80,11 +80,11 @@ macro(DYNAMIC_ANTS_BUILD ANTS_FUNCTION_NAME EXTRA_LIBS)
|
|
target_link_libraries( ${ANTS_FUNCTION_NAME} l_${ANTS_FUNCTION_NAME} )
|
|
|
|
install(TARGETS l_${ANTS_FUNCTION_NAME} ${ANTS_FUNCTION_NAME}
|
|
- RUNTIME DESTINATION bin
|
|
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
COMPONENT RUNTIME_${ANTS_FUNCTION_NAME}
|
|
- LIBRARY DESTINATION lib
|
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT RUNTIME_${ANTS_FUNCTION_NAME}
|
|
- ARCHIVE DESTINATION lib
|
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
COMPONENT DEVELOPMENT_${ANTS_FUNCTION_NAME}
|
|
)
|
|
endif()
|