How cmake specify “Platform Toolset” for a Visual

2019-01-09 14:43发布

问题:

There is a VS2015 project which is generated by cmake and I want to change its "Platform Toolset"

"Platform Toolset" Location

I have tried these solutions but can't work:

  1. set (CMAKE_VS_PLATFORM_TOOLSET "v120")

  2. cmake -T "v120"

Can anyone help? Thanks.

回答1:

First of all: remove the CMakeCache.txt if you have already generated your project. Next run cmake:

cmake -G "Visual Studio 14" -T v120

Whenever you need to change your generator(and the toolset is a part of it) you should remove the CMakeCache.txt file.