summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrian Van Essen <vanessen1@llnl.gov>2023-12-08 09:27:44 -0800
committerGitHub <noreply@github.com>2023-12-08 09:27:44 -0800
commit5d999d0e4fb59b8eedc7519a6ed7d9361ce60688 (patch)
tree992edf02e868c7b522d1871ca55844c8efbf3a7b /lib
parent694a1ff340361670d3af8ebb37e72dd1bf30eeb1 (diff)
downloadspack-5d999d0e4fb59b8eedc7519a6ed7d9361ce60688.tar.gz
spack-5d999d0e4fb59b8eedc7519a6ed7d9361ce60688.tar.bz2
spack-5d999d0e4fb59b8eedc7519a6ed7d9361ce60688.tar.xz
spack-5d999d0e4fb59b8eedc7519a6ed7d9361ce60688.zip
Add logic to cache the RPATH variables in CachedCMakePackages. (#41417)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/cached_cmake.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/spack/spack/build_systems/cached_cmake.py b/lib/spack/spack/build_systems/cached_cmake.py
index 74304f1dc6..69a03913fd 100644
--- a/lib/spack/spack/build_systems/cached_cmake.py
+++ b/lib/spack/spack/build_systems/cached_cmake.py
@@ -9,6 +9,7 @@ from typing import Tuple
import llnl.util.filesystem as fs
import llnl.util.tty as tty
+import spack.build_environment
import spack.builder
from .cmake import CMakeBuilder, CMakePackage
@@ -285,6 +286,19 @@ class CachedCMakeBuilder(CMakeBuilder):
def std_initconfig_entries(self):
cmake_prefix_path_env = os.environ["CMAKE_PREFIX_PATH"]
cmake_prefix_path = cmake_prefix_path_env.replace(os.pathsep, ";")
+ cmake_rpaths_env = spack.build_environment.get_rpaths(self.pkg)
+ cmake_rpaths_path = ";".join(cmake_rpaths_env)
+ complete_rpath_list = cmake_rpaths_path
+ if "SPACK_COMPILER_EXTRA_RPATHS" in os.environ:
+ spack_extra_rpaths_env = os.environ["SPACK_COMPILER_EXTRA_RPATHS"]
+ spack_extra_rpaths_path = spack_extra_rpaths_env.replace(os.pathsep, ";")
+ complete_rpath_list = "{0};{1}".format(complete_rpath_list, spack_extra_rpaths_path)
+
+ if "SPACK_COMPILER_IMPLICIT_RPATHS" in os.environ:
+ spack_implicit_rpaths_env = os.environ["SPACK_COMPILER_IMPLICIT_RPATHS"]
+ spack_implicit_rpaths_path = spack_implicit_rpaths_env.replace(os.pathsep, ";")
+ complete_rpath_list = "{0};{1}".format(complete_rpath_list, spack_implicit_rpaths_path)
+
return [
"#------------------{0}".format("-" * 60),
"# !!!! This is a generated file, edit at own risk !!!!",
@@ -292,6 +306,9 @@ class CachedCMakeBuilder(CMakeBuilder):
"# CMake executable path: {0}".format(self.pkg.spec["cmake"].command.path),
"#------------------{0}\n".format("-" * 60),
cmake_cache_string("CMAKE_PREFIX_PATH", cmake_prefix_path),
+ cmake_cache_string("CMAKE_INSTALL_RPATH_USE_LINK_PATH", "ON"),
+ cmake_cache_string("CMAKE_BUILD_RPATH", complete_rpath_list),
+ cmake_cache_string("CMAKE_INSTALL_RPATH", complete_rpath_list),
self.define_cmake_cache_from_variant("CMAKE_BUILD_TYPE", "build_type"),
]