summaryrefslogtreecommitdiffstats
path: root/Modules/Platform
diff options
context:
space:
mode:
authorArkady Shapkin <arkady.shapkin@gmail.com>2018-03-21 23:01:37 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-04 17:21:09 (GMT)
commit304f493e570a177795575b5297c4b54bf1b3d2ac (patch)
tree64dbffb82db45265a672efee7b821aaf337704ad /Modules/Platform
parent561238bb6f07a5ab31293928bd98f6f8911d8bc1 (diff)
downloadCMake-304f493e570a177795575b5297c4b54bf1b3d2ac.zip
CMake-304f493e570a177795575b5297c4b54bf1b3d2ac.tar.gz
CMake-304f493e570a177795575b5297c4b54bf1b3d2ac.tar.bz2
MSVC: Add MSVC_TOOLSET_VERSION variable
Provide the MSVC toolset version number based on the compiler version. Fixes: #16923
Diffstat (limited to 'Modules/Platform')
-rw-r--r--Modules/Platform/Windows-MSVC.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index a1f54c0..ae180ed 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -71,6 +71,31 @@ if(NOT MSVC_VERSION)
message(FATAL_ERROR "MSVC compiler version not detected properly: ${_compiler_version}")
endif()
+ if(MSVC_VERSION GREATER_EQUAL 1910)
+ # VS 2017 or greater
+ set(MSVC_TOOLSET_VERSION 141)
+ elseif(MSVC_VERSION EQUAL 1900)
+ # VS 2015
+ set(MSVC_TOOLSET_VERSION 140)
+ elseif(MSVC_VERSION EQUAL 1800)
+ # VS 2013
+ set(MSVC_TOOLSET_VERSION 120)
+ elseif(MSVC_VERSION EQUAL 1700)
+ # VS 2012
+ set(MSVC_TOOLSET_VERSION 110)
+ elseif(MSVC_VERSION EQUAL 1600)
+ # VS 2010
+ set(MSVC_TOOLSET_VERSION 100)
+ elseif(MSVC_VERSION EQUAL 1500)
+ # VS 2008
+ set(MSVC_TOOLSET_VERSION 90)
+ elseif(MSVC_VERSION EQUAL 1400)
+ # VS 2005
+ set(MSVC_TOOLSET_VERSION 80)
+ else()
+ # We don't support MSVC_TOOLSET_VERSION for earlier compiler.
+ endif()
+
set(MSVC10)
set(MSVC11)
set(MSVC12)