From 530669346ab0a9ae9931d2e980c7d38325e43b99 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Tue, 11 Apr 2023 19:04:34 -0400 Subject: Windows/MSVC: propagate all VCVARS changes to Spack env (#36582) MSVC compilers rely on vcvars environment setup scripts to establish build environement variables neccesary for all projects to build successfully. Prior to this we were only piping LIB, INCLUDE, and PATH change through. Instead we need to propegate all changes to the env variables made by VCVARs in order to establish robust support for the MSVC compiler. This most significantly impacts projects that need to be build with NMake and MSBuild --- lib/spack/spack/compilers/msvc.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/spack/spack/compilers/msvc.py b/lib/spack/spack/compilers/msvc.py index 9be10b0826..061555a500 100644 --- a/lib/spack/spack/compilers/msvc.py +++ b/lib/spack/spack/compilers/msvc.py @@ -169,10 +169,11 @@ class Msvc(Compiler): if key and value ) - if "path" in int_env: - env.set_path("PATH", int_env["path"].split(";")) - env.set_path("INCLUDE", int_env.get("include", "").split(";")) - env.set_path("LIB", int_env.get("lib", "").split(";")) + for env_var in int_env: + if os.pathsep not in int_env[env_var]: + env.set(env_var, int_env[env_var]) + else: + env.set_path(env_var, int_env[env_var].split(os.pathsep)) env.set("CC", self.cc) env.set("CXX", self.cxx) -- cgit v1.2.3-70-g09d2