Optionally enable system installation of binaries

If the option PRIVATE_INSTALL is set to OFF, LSB-compliant paths are
used for the `install' target.
This commit is contained in:
Roland Kaufmann 2013-03-26 23:00:09 +01:00
parent 3fcd05e838
commit e7613fe9ee
2 changed files with 18 additions and 0 deletions

View File

@ -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)

View File

@ -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