[CMake] MSVC15 variable available for Visual Studio 2017

Gregor Jasny gjasny at googlemail.com
Wed Jan 11 08:33:26 EST 2017


Hello,

I wonder if there is a reason why no MSVC15 variable is available for 
Visual Studio 2017? I'm using those MSVCxx variables and 
CMAKE_GENERATOR_TOOLSET to detect the active toolset:

>   # Visual Studio 2008
>   if((MSVC90 AND "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "") OR (CMAKE_GENERATOR_TOOLSET MATCHES "v90"))
>     set(COL_BUILD_TOOLCHAIN)
>   elseif((MSVC11 AND "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "") OR (CMAKE_GENERATOR_TOOLSET MATCHES "^v110.*"))
>     set(COL_BUILD_TOOLCHAIN _v110)
>   elseif((MSVC12 AND "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "") OR (CMAKE_GENERATOR_TOOLSET MATCHES "^v120.*"))
>     set(COL_BUILD_TOOLCHAIN _v120)
>   elseif((MSVC14 AND "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "") OR (CMAKE_GENERATOR_TOOLSET MATCHES "^v140.*"))
>     set(COL_BUILD_TOOLCHAIN _v140)
>   else()
>     message(FATAL_ERROR "Unknown Visual Studio version (${MSVC_VERSION}) or generator toolset (${CMAKE_GENERATOR_TOOLSET})")
>   endif()

If I now select the Visual Studio 2017 compiler but omit the toolset on 
the command line, the CMAKE_GENERATOR_TOOLSET is empty and MSVC15 is not 
set. I wonder how I could detect the v141(_xp) toolset?



Thanks,
Gregor


More information about the CMake mailing list