From d9cc43e76d78f836a9c3b3306af8cbd281033b64 Mon Sep 17 00:00:00 2001 From: Pieter Ghysels Date: Tue, 15 Aug 2023 22:32:58 -0700 Subject: [PATCH] Set the RPATH in the installed strumpack library --- CMakeLists.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1834acca..ff1733e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,29 @@ include(GNUInstallDirs) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") +############################################################## +## settings for RPATH, +## see https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling +# use, i.e. don't skip the full RPATH for the build tree +set(CMAKE_SKIP_BUILD_RPATH FALSE) + +# when building, don't use the install RPATH already +# (but later on when installing) +set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}") + +# add the automatically determined parts of the RPATH +# which point to directories outside the build tree to the install RPATH +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_LIBDIR}" isSystemDir) +if("${isSystemDir}" STREQUAL "-1") + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}") +endif("${isSystemDir}" STREQUAL "-1") +############################################################## + # figure out Fortran/C name mangling include(FortranCInterface) FortranCInterface_HEADER(