1

I created a cmake project through MSVS2019 and need to set Target Platform Version to 8.1 (instead of the default 10.0) and Platform Toolset to v140 (as opposed to 142).

Here are the two settings if I were working with a msvs project (instead of cmake in msvs2019):

enter image description here

The documentation for cmake on msvs2019 is pretty sparse and wish there was some kind of mapping between visual studio project settings and cmake.

theNotSoPro
  • 308
  • 3
  • 16
  • CMake allows you to set the platform toolset. Related: [https://cmake.org/cmake/help/v3.21/variable/CMAKE_GENERATOR_TOOLSET.html#variable:CMAKE_GENERATOR_TOOLSET](https://cmake.org/cmake/help/v3.21/variable/CMAKE_GENERATOR_TOOLSET.html#variable:CMAKE_GENERATOR_TOOLSET) – drescherjm Jun 24 '21 at 01:46
  • 1
    @theNotSoPro I suggest you could try to refer to the thread: https://stackoverflow.com/questions/35549164/how-does-cmake-specify-platform-toolset-for-a-visual-studio-2015-project – Jeaninez - MSFT Jun 24 '21 at 05:34
  • Does this answer your question? [How does CMake specify "Platform Toolset" for a Visual Studio 2015 project?](https://stackoverflow.com/questions/35549164/how-does-cmake-specify-platform-toolset-for-a-visual-studio-2015-project) – drescherjm Jun 24 '21 at 15:06

1 Answers1

0

This was working for me:

set_target_properties( MyProjectName 
          PROPERTIES
               VS_PLATFORM_TOOLSET v140 )