diff options
author | Arkady Shapkin <arkady.shapkin@gmail.com> | 2018-03-22 02:01:37 +0300 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-04-04 13:21:09 -0400 |
commit | 304f493e570a177795575b5297c4b54bf1b3d2ac (patch) | |
tree | 64dbffb82db45265a672efee7b821aaf337704ad /Modules/Platform | |
parent | 561238bb6f07a5ab31293928bd98f6f8911d8bc1 (diff) | |
download | cmake-304f493e570a177795575b5297c4b54bf1b3d2ac.tar.gz |
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.cmake | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index a1f54c0bbc..ae180ed7cb 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) |