如何使用 CMake 生成 Windows 10 通用项目

我正在尝试使用 CMake 为 Windows 10 生成 Visual Studio 15 项目 c++ 静态库.它应该可以在手机上使用,所以我认为它应该支持 Windows 商店.我可以设置任何标志吗?

I'm trying to use CMake to generate Visual Studio 15 project c++ static library for Windows 10. It should be usable on phones so I think it should have support for windows store. Are there any flags I can set?

我找到了 https://github.com/Microsoft/CMake,它是微软的 CMake 分支,但我找不到如何使用它来启用通用应用支持的线索.

I've found https://github.com/Microsoft/CMake, it is Microsoft's fork of CMake, but I can't find a clue how to use it to enable uniwersal app support.

使用正常"cmake,当我打开对 windows stope 的支持时,出现错误:

With "normal" cmake when i switch on support for windows stope I get an Error:

错误 MSB3843:项目project1"面向平台Windows",但引用了面向平台UAP"的 SDKVisual C++ 2015 Runtime for Universal Windows Platform Apps v14.0".

error MSB3843: Project "project1" targets platform "Windows", but references SDK "Visual C++ 2015 Runtime for Universal Windows Platform Apps v14.0" which targets platform "UAP".

推荐答案

CMake -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0

CMake -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0

相关文章