File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed
Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -267,12 +267,30 @@ if(NOT UNITS_HEADER_ONLY AND UNITS_BUILD_PYTHON_LIBRARY)
267267 # Install directive for scikit-build-core
268268 install (TARGETS units_llnl_ext LIBRARY DESTINATION units_llnl)
269269 if (UNITS_BUILD_SHARED_LIBRARY)
270- if (NOT MSVC )
271- target_link_options (units_llnl_ext PRIVATE "-Wl,-rpath='$ORIGIN'" )
272- set_target_properties (
273- units_llnl_ext PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE
274- )
275- endif ()
270+
271+
272+ # -------------------------------------------------------------
273+ # setting the RPATH
274+ # -------------------------------------------------------------
275+ if (NOT DEFINED CMAKE_MACOSX_RPATH)
276+ set (CMAKE_MACOSX_RPATH ON )
277+ endif ()
278+
279+ # add the automatically determined parts of the RPATH which point to directories outside the build
280+ # tree to the install RPATH
281+ if (NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH )
282+ set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
283+ endif ()
284+
285+ # Add the local directory to the rpath
286+ if (NOT APPLE )
287+ list (APPEND CMAKE_INSTALL_RPATH $ORIGIN)
288+ else ()
289+ list (APPEND CMAKE_INSTALL_RPATH "@loader_path" )
290+ list (APPEND CMAKE_INSTALL_RPATH "@executable_path" )
291+ endif ()
292+
293+
276294 install (
277295 TARGETS units
278296 RUNTIME DESTINATION units_llnl
You can’t perform that action at this time.
0 commit comments