From 46745e13fbe2aa44a42d01d04226a1d29ae80298 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 26 Aug 2024 12:10:39 -0500 Subject: [PATCH] Make sure RPATH gets set on installed version --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f00aa44..8c461280 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,14 +96,14 @@ endif () set( CMAKE_SKIP_BUILD_RPATH FALSE ) set( CMAKE_BUILD_WITH_INSTALL_RPATH FALSE ) -if ( CMAKE_SYSTEM_NAME STREQUAL "Darwin" ) - set( rpath_prefix "@loader_path" ) -else() - set( rpath_prefix "\\$ORIGIN" ) -endif() -list( INSERT 0 CMAKE_INSTALL_RPATH "${rpath_prefix}/../lib" ) set( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE ) +# the RPATH to be used when installing, but only if it's not a system directory +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) +if("${isSystemDir}" STREQUAL "-1") + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +endif("${isSystemDir}" STREQUAL "-1") + if ( NOT GIT_EXECUTABLE ) find_package( Git ) if ( NOT GIT_FOUND )