summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-01-19 20:59:23 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2015-01-19 20:59:23 -0800
commit51ed0d3f6f3ba8cf3c7a17db967aead0b691e3a4 (patch)
tree50f3ff927c4343c606f941cb9f5d60f00686d37b
parent2a0e33876ec9f6e33a0408228463a021a1809668 (diff)
downloadspack-51ed0d3f6f3ba8cf3c7a17db967aead0b691e3a4.tar.gz
spack-51ed0d3f6f3ba8cf3c7a17db967aead0b691e3a4.tar.bz2
spack-51ed0d3f6f3ba8cf3c7a17db967aead0b691e3a4.tar.xz
spack-51ed0d3f6f3ba8cf3c7a17db967aead0b691e3a4.zip
Properly set install RPATHS for cmake builds.
-rw-r--r--lib/spack/spack/build_environment.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 45353ec640..70b5c89411 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -183,6 +183,10 @@ def set_module_variables_for_package(pkg):
if platform.mac_ver()[0]:
m.std_cmake_args.append('-DCMAKE_FIND_FRAMEWORK=LAST')
+ # Set up CMake rpath
+ m.std_cmake_args.append('-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE')
+ m.std_cmake_args.append('-DCMAKE_INSTALL_RPATH=%s' % ":".join(get_rpaths(pkg)))
+
# Emulate some shell commands for convenience
m.pwd = os.getcwd
m.cd = os.chdir
@@ -202,6 +206,16 @@ def set_module_variables_for_package(pkg):
m.prefix = pkg.prefix
+def get_rpaths(pkg):
+ """Get a list of all the rpaths for a package."""
+ rpaths = [pkg.prefix.lib, pkg.prefix.lib64]
+ rpaths.extend(d.prefix.lib for d in pkg.spec.traverse(root=False)
+ if os.path.isdir(d.prefix.lib))
+ rpaths.extend(d.prefix.lib64 for d in pkg.spec.traverse(root=False)
+ if os.path.isdir(d.prefix.lib64))
+ return rpaths
+
+
def setup_package(pkg):
"""Execute all environment setup routines."""
set_compiler_environment_variables(pkg)