summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/compilers/msvc.py45
1 files changed, 38 insertions, 7 deletions
diff --git a/lib/spack/spack/compilers/msvc.py b/lib/spack/spack/compilers/msvc.py
index 9914e5242a..f6e86f831a 100644
--- a/lib/spack/spack/compilers/msvc.py
+++ b/lib/spack/spack/compilers/msvc.py
@@ -231,24 +231,55 @@ class Msvc(Compiler):
@property
def short_msvc_version(self):
+ """This is the shorthand VCToolset version of form
+ MSVC<short-ver>
"""
- This is the shorthand VCToolset version of form
- MSVC<short-ver> *NOT* the full version, for that see
+ return "MSVC" + self.vc_toolset_ver
+
+ @property
+ def vc_toolset_ver(self):
+ """
+ The toolset version is the version of the combined set of cl and link
+ This typically relates directly to VS version i.e. VS 2022 is v143
+ VS 19 is v142, etc.
+ This value is defined by the first three digits of the major + minor
+ version of the VS toolset (143 for 14.3x.bbbbb). Traditionally the
+ minor version has remained a static two digit number for a VS release
+ series, however, as of VS22, this is no longer true, both
+ 14.4x.bbbbb and 14.3x.bbbbb are considered valid VS22 VC toolset
+ versions due to a change in toolset minor version sentiment.
+
+ This is *NOT* the full version, for that see
Msvc.msvc_version or MSVC.platform_toolset_ver for the
raw platform toolset version
+
"""
- ver = self.platform_toolset_ver
- return "MSVC" + ver
+ ver = self.msvc_version[:2].joined.string[:3]
+ return ver
@property
def platform_toolset_ver(self):
"""
This is the platform toolset version of current MSVC compiler
- i.e. 142.
+ i.e. 142. The platform toolset is the targeted MSVC library/compiler
+ versions by compilation (this is different from the VC Toolset)
+
+
This is different from the VC toolset version as established
- by `short_msvc_version`
+ by `short_msvc_version`, but typically are represented by the same
+ three digit value
"""
- return self.msvc_version[:2].joined.string[:3]
+ # Typically VS toolset version and platform toolset versions match
+ # VS22 introduces the first divergence of VS toolset version
+ # (144 for "recent" releases) and platform toolset version (143)
+ # so it needs additional handling until MS releases v144
+ # (assuming v144 is also for VS22)
+ # or adds better support for detection
+ # TODO: (johnwparent) Update this logic for the next platform toolset
+ # or VC toolset version update
+ toolset_ver = self.vc_toolset_ver
+ vs22_toolset = Version(toolset_ver) > Version("142")
+ return toolset_ver if not vs22_toolset else "143"
def _compiler_version(self, compiler):
"""Returns version object for given compiler"""