[CMake] MSVC15 variable available for Visual Studio 2017

Brad King brad.king at kitware.com
Wed Jan 11 10:20:35 EST 2017


On 01/11/2017 08:33 AM, Gregor Jasny via CMake wrote:
> I wonder if there is a reason why no MSVC15 variable is available for 
> Visual Studio 2017?

The values correspond to the toolset versions:

* https://cmake.org/cmake/help/v3.7/variable/MSVC14.html

and VS 2017 uses toolset version v141 which is still "14".

At the time the VS 2017 generator was first written we were using a
VS 15 preview and its toolset was still called v140.  Please submit
a MR to update the above-linked docs to mention that MSVC14 is for
v140 or v141.

> I wonder how I could detect the v141(_xp) toolset?

Use CMAKE_C_COMPILER_VERSION instead.  The `MSVC##` variables are legacy,
though not deprecated because they can still be handy due to the
"or another compiler that simulates it" part of the documentation.

-Brad



More information about the CMake mailing list