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
This commit is contained in:
John W. Parent 2023-04-11 19:04:34 -04:00 committed by GitHub
parent 68f50f9b11
commit 530669346a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -169,10 +169,11 @@ def setup_custom_environment(self, pkg, env):
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)