diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_environment.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 83aa634276..fa1ad76274 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -185,6 +185,13 @@ def clean_environment(): env.unset('LD_PRELOAD') env.unset('DYLD_INSERT_LIBRARIES') + # Avoid <packagename>_ROOT user variables overriding spack dependencies + # https://cmake.org/cmake/help/latest/variable/PackageName_ROOT.html + # Spack needs SPACK_ROOT though, so we need to exclude that + for varname in os.environ.keys(): + if varname.endswith('_ROOT') and varname != 'SPACK_ROOT': + env.unset(varname) + # On Cray "cluster" systems, unset CRAY_LD_LIBRARY_PATH to avoid # interference with Spack dependencies. # CNL requires these variables to be set (or at least some of them, |