Skip to content

Commit

Permalink
CMakePackage: use @rpath for shared libs on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
goxberry authored and kresan committed Aug 23, 2019
1 parent 406c791 commit 5466caf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/spack/spack/build_systems/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,16 @@ def _std_args(pkg):
if platform.mac_ver()[0]:
args.extend([
'-DCMAKE_FIND_FRAMEWORK:STRING=LAST',
'-DCMAKE_FIND_APPBUNDLE:STRING=LAST'
'-DCMAKE_FIND_APPBUNDLE:STRING=LAST',
'-DCMAKE_MACOSX_RPATH:BOOL=ON',
])

# Set up CMake rpath
args.append('-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=FALSE')
rpaths = ';'.join(spack.build_environment.get_rpaths(pkg))
if platform.mac_ver()[0]:
rpaths = ';'.join([rpaths, '@rpath'])

args.append('-DCMAKE_INSTALL_RPATH:STRING={0}'.format(rpaths))
# CMake's find_package() looks in CMAKE_PREFIX_PATH first, help CMake
# to find immediate link dependencies in right places:
Expand Down

0 comments on commit 5466caf

Please sign in to comment.