From ace63d1837f4cd3c919b809f4c4d06f75aa1a633 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Fri, 29 Mar 2024 00:47:16 +0600 Subject: [PATCH 1/3] configure RPATH --- CMakeLists.txt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa53ae5398..f310eb1267 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,13 +119,20 @@ include(GNUInstallDirs) # the OSX RPATH settings have been updated per recommendations found # in the CMake Wiki: # http://www.cmake.org/Wiki/CMake_RPATH_handling#Mac_OS_X_and_the_RPATH -set(CMAKE_MACOSX_RPATH ON) -set(CMAKE_SKIP_BUILD_RPATH FALSE) -set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +option(CMAKE_MACOSX_RPATH "Enable macOS RPATH" ON) +message(STATUS "Enable macOS RPATH: ${CMAKE_MACOSX_RPATH}") +option(CMAKE_SKIP_BUILD_RPATH "Skip build-time RPATH" OFF) +message(STATUS "Skip build-time RPATH: ${CMAKE_SKIP_BUILD_RPATH}") +option(CMAKE_BUILD_WITH_INSTALL_RPATH "Build with install RPATH" OFF) +message(STATUS "Build with install RPATH: ${CMAKE_BUILD_WITH_INSTALL_RPATH}") + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_FULL_LIBDIR} isSystemDir) -if("${isSystemDir}" STREQUAL "-1") - set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +if ("${isSystemDir}" STREQUAL "-1") + option(CMAKE_INSTALL_RPATH "Install RPATH" ${CMAKE_INSTALL_FULL_LIBDIR}) + message(STATUS "Install RPATH: ${CMAKE_INSTALL_RPATH}") + option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Use link path for RPATH" ON) + message(STATUS "Install RPATH use link path: ${CMAKE_INSTALL_RPATH_USE_LINK_PATH}") endif() From ffc3a93c221d3026bf418aefbd5cd56623ecc523 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Wed, 22 May 2024 23:29:07 +0600 Subject: [PATCH 2/3] CMAKE_INSTALL_FULL_LIBDIR --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f310eb1267..9934d57331 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,7 +129,9 @@ message(STATUS "Build with install RPATH: ${CMAKE_BUILD_WITH_INSTALL_RPATH}") list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_FULL_LIBDIR} isSystemDir) if ("${isSystemDir}" STREQUAL "-1") - option(CMAKE_INSTALL_RPATH "Install RPATH" ${CMAKE_INSTALL_FULL_LIBDIR}) + if(${CMAKE_INSTALL_FULL_LIBDIR}) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) + endif() message(STATUS "Install RPATH: ${CMAKE_INSTALL_RPATH}") option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Use link path for RPATH" ON) message(STATUS "Install RPATH use link path: ${CMAKE_INSTALL_RPATH_USE_LINK_PATH}") From c308ea602e22aec940ccd8e205354287c7602a80 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Wed, 22 May 2024 23:47:19 +0600 Subject: [PATCH 3/3] CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9934d57331..2f443104f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ if ("${isSystemDir}" STREQUAL "-1") set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) endif() message(STATUS "Install RPATH: ${CMAKE_INSTALL_RPATH}") - option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Use link path for RPATH" ON) + option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Use link path for RPATH" TRUE) message(STATUS "Install RPATH use link path: ${CMAKE_INSTALL_RPATH_USE_LINK_PATH}") endif()