From c718423ba68019411c1e85afda9991ac3ccd8329 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 31 Mar 2022 01:48:30 -0400 Subject: [PATCH] COMP: Support configuring project specifying custom CMAKE_MACOSX_RPATH value This commit updates the build-system to set CMAKE_MACOSX_RPATH to TRUE only if is not already defined in the current scope. The default behavior remains unchanged. This allows to successfully configure the project with the following options so that RPATH with absolute paths is used for both the build and install trees: -DCMAKE_MACOSX_RPATH:BOOL=FALSE -DCMAKE_INSTALL_NAME_DIR:PATH=/path/to/install/dir --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59fefd5b..2c49bffd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,7 +189,9 @@ endif(USE_PYTHON) set(NG_INSTALL_DIR EXPORT netgen-targets RUNTIME DESTINATION ${NG_INSTALL_DIR_BIN} COMPONENT netgen LIBRARY DESTINATION ${NG_INSTALL_DIR_LIB} COMPONENT netgen_devel ARCHIVE DESTINATION ${NG_INSTALL_DIR_LIB} COMPONENT netgen_devel) install(EXPORT netgen-targets DESTINATION ${NG_INSTALL_DIR_CMAKE} COMPONENT netgen_devel) -set(CMAKE_MACOSX_RPATH TRUE) +if(NOT DEFINED CMAKE_MACOSX_RPATH) + set(CMAKE_MACOSX_RPATH TRUE) +endif(NOT DEFINED CMAKE_MACOSX_RPATH) set(CMAKE_INSTALL_RPATH "${NG_RPATH_TOKEN};${NG_RPATH_TOKEN}/${NETGEN_RPATH}") if(BUILD_FOR_CONDA) file(RELATIVE_PATH py_rpath "/bin" "/${NG_INSTALL_DIR_LIB}")