简体   繁体   English

如何使用CMake设置MSVC目标平台版本?

[英]How to set MSVC Target Platform Version with CMake?

I'm searching for way to set Target Platform Version of MSVC project generated with CMake . 我正在寻找设置用CMake生成的MSVC项目的目标平台版本的方法。 I found the following ticket in CMake issue tracker which is now closed. 我在CMake问题跟踪器中找到了以下票据 ,该票据现已关闭。 I'm with latest 3.9.1 version of CMake . 我是最新的3.9.1版本的CMake But the solution described there seems to not work. 但是那里描述的解决方案似乎不起作用。 I tried 我试过了

set (CMAKE_SYSTEM_VERSION 8.1)

in my CMakeLists.txt . 在我的CMakeLists.txt

How to set Terget Platform Version when using CMake? 如何在使用CMake时设置Terget平台版本

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_SYSTEM_VERSION ,但我想尽可能从CMakeLists.txt文件中设置它。

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 . 至少能够从CMake GUI设置它是一件好事。

在首次使用project之前使用set (CMAKE_SYSTEM_VERSION 8.1 CACHE TYPE INTERNAL FORCE)解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM