From 5d999d0e4fb59b8eedc7519a6ed7d9361ce60688 Mon Sep 17 00:00:00 2001 From: Brian Van Essen Date: Fri, 8 Dec 2023 09:27:44 -0800 Subject: Add logic to cache the RPATH variables in CachedCMakePackages. (#41417) --- lib/spack/spack/build_systems/cached_cmake.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib') 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"), ] -- cgit v1.2.3-60-g2f50