From 0b12a480eb7ccced87a153c1e89dfa7f3e307d84 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Thu, 25 May 2023 21:38:04 -0400 Subject: Windows MSVC: do not set sdk version if installing sdk (#37930) Note the win-sdk package is not installable and reports an error which instructs the user how to add it. Without this fix, a (more confusing) error occurs before this message can be generated. --- lib/spack/spack/compilers/msvc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/compilers/msvc.py b/lib/spack/spack/compilers/msvc.py index 54d159d6a7..6e9d1d0277 100644 --- a/lib/spack/spack/compilers/msvc.py +++ b/lib/spack/spack/compilers/msvc.py @@ -151,7 +151,11 @@ class Msvc(Compiler): arch = arch.replace("-", "_") # vcvars can target specific sdk versions, force it to pick up concretized sdk # version, if needed by spec - sdk_ver = "" if "win-sdk" not in pkg.spec else pkg.spec["win-sdk"].version.string + ".0" + sdk_ver = ( + "" + if "win-sdk" not in pkg.spec or pkg.name == "win-sdk" + else pkg.spec["win-sdk"].version.string + ".0" + ) # provide vcvars with msvc version selected by concretization, # not whatever it happens to pick up on the system (highest available version) out = subprocess.check_output( # novermin -- cgit v1.2.3-70-g09d2