问题
I'm searching for way to set Target Platform Version of MSVC project generated with CMake. I found the following ticket in CMake issue tracker which is now closed. I'm with latest 3.9.1
version of CMake. But the solution described there seems to not work. I tried
set (CMAKE_SYSTEM_VERSION 8.1)
in my CMakeLists.txt
.
How to set Terget Platform Version when using CMake?
Afterwords:
Now I checked that setting CMAKE_SYSTEM_VERSION
from command line when generating solution works but I want if possible to be able to set this from CMakeLists.txt
file.
cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_SYSTEM_VERSION=8.1 ..\source\
At least it will be good to be able to set this from CMake GUI.
回答1:
Using set (CMAKE_SYSTEM_VERSION 8.1 CACHE TYPE INTERNAL FORCE)
before first usage of project
solves the problem.
来源:https://stackoverflow.com/questions/45692367/how-to-set-msvc-target-platform-version-with-cmake