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
This commit is contained in:
Jean-Christophe Fillion-Robin 2022-03-31 01:48:30 -04:00
parent 1de4d6e1e5
commit c718423ba6
No known key found for this signature in database
GPG Key ID: C588BCAD0295020A

View File

@ -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) 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) 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}") set(CMAKE_INSTALL_RPATH "${NG_RPATH_TOKEN};${NG_RPATH_TOKEN}/${NETGEN_RPATH}")
if(BUILD_FOR_CONDA) if(BUILD_FOR_CONDA)
file(RELATIVE_PATH py_rpath "/bin" "/${NG_INSTALL_DIR_LIB}") file(RELATIVE_PATH py_rpath "/bin" "/${NG_INSTALL_DIR_LIB}")