From e7613fe9eeb2e8cb76818e067dbe3e18a46a7321 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Tue, 26 Mar 2013 23:00:09 +0100 Subject: [PATCH] Optionally enable system installation of binaries If the option PRIVATE_INSTALL is set to OFF, LSB-compliant paths are used for the `install' target. --- ApplicationCode/CMakeLists.txt | 14 ++++++++++++++ CMakeLists.txt | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/ApplicationCode/CMakeLists.txt b/ApplicationCode/CMakeLists.txt index fe9fe97a12..e1b46f3602 100644 --- a/ApplicationCode/CMakeLists.txt +++ b/ApplicationCode/CMakeLists.txt @@ -266,6 +266,9 @@ set (RESINSIGHT_LICENSE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/Adm/gplLicense.txt ) +# bundle libraries together with private installation +if (PRIVATE_INSTALL) + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # tell binary to first attempt to load libraries from its own directory set_target_properties (ResInsight PROPERTIES INSTALL_RPATH "\$ORIGIN") @@ -303,3 +306,14 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resinsight DESTINATION ${RESINSIGHT_FINAL_NAME} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) endif() +else (PRIVATE_INSTALL) + # binaries go in /usr/bin + install (TARGETS ResInsight + DESTINATION bin + ) + # license go in /usr/share/doc + install (FILES ${RESINSIGHT_LICENSE_FILES} + DESTINATION share/doc/ResInsight + ) + # no bundled libraries for system install +endif (PRIVATE_INSTALL) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a8ca92a40..e09c59183a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,8 +114,12 @@ if (NOT "${RESINSIGHT_PLATFORM}" STREQUAL "") set (RESINSIGHT_FINAL_NAME "${RESINSIGHT_FINAL_NAME}-${RESINSIGHT_PLATFORM}") endif() +# override system install prefix if private installation chosen +option (PRIVATE_INSTALL "Install in a private directory" ON) +if (PRIVATE_INSTALL) set (CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install/) #set (CMAKE_INSTALL_PREFIX /usr/${RESINSIGHT_FINAL_NAME}) +endif (PRIVATE_INSTALL) ################################################################################ # Application