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

2023-09-27C/C++开发问题
0

本文介绍了如何使用 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

这篇关于如何使用 CMake 生成 Windows 10 通用项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

无法访问 C++ std::set 中对象的非常量成员函数
Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)...
2024-08-14 C/C++开发问题
17

从 lambda 构造 std::function 参数
Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)...
2024-08-14 C/C++开发问题
25

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

使用 std::atomic 和 std::condition_variable 同步不可靠
Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)...
2024-08-14 C/C++开发问题
17

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么禁止对存储在 STL 容器中的类重载 operator&()?
Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)...
2024-08-14 C/C++开发问题
6