summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/compilers/msvc.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/spack/spack/compilers/msvc.py b/lib/spack/spack/compilers/msvc.py
index 0954d0b7d3..c3e9e13d71 100644
--- a/lib/spack/spack/compilers/msvc.py
+++ b/lib/spack/spack/compilers/msvc.py
@@ -293,6 +293,17 @@ class Msvc(Compiler):
vs22_toolset = Version(toolset_ver) > Version("142")
return toolset_ver if not vs22_toolset else "143"
+ @property
+ def visual_studio_version(self):
+ """The four digit Visual Studio version (i.e. 2019 or 2022)
+
+ Note: This differs from the msvc version or toolset version as
+ those properties track the compiler and build tools version
+ respectively, whereas this tracks the VS release associated
+ with a given MSVC compiler.
+ """
+ return re.search(r"[0-9]{4}", self.cc).group(0)
+
def _compiler_version(self, compiler):
"""Returns version object for given compiler"""
# ignore_errors below is true here due to ifx's