P.X
P.X

Reputation: 551

How does CMake specify "Platform Toolset" for a Visual Studio 2015 project?

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 it doesn't work:

  1. set (CMAKE_VS_PLATFORM_TOOLSET "v120")

  2. cmake -T "v120"

Can anyone help? Thanks.

Upvotes: 23

Views: 22984

Answers (4)

Mariusz Wawrzonkowski
Mariusz Wawrzonkowski

Reputation: 171

you can also assign platform toolset per-project using example below:

set_target_properties( MyProjectName 
          PROPERTIES
               VS_PLATFORM_TOOLSET ClangCL )

Upvotes: 2

FrankPIE
FrankPIE

Reputation: 71

Using CMAKE_GENERATOR_TOOLSET is better than using the -T option.

It's not required to remove the CMakeCache.txt file when re-generating CMake.

e.g.

cmake -G "Visual Studio 16" -A Win32 -DCMAKE_GENERATOR_TOOLSET=v140

Upvotes: 7

evilrix
evilrix

Reputation: 172

For anyone finding this, the solution is to use CMAKE_SYSTEM_VERSION.

eg.

cmake -DCMAKE_SYSTEM_VERSION=8.1 .

Upvotes: -1

ixSci
ixSci

Reputation: 13698

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.

Upvotes: 37

Related Questions