CMake的Nuget包 [英] Nuget package from CMake

查看:166
本文介绍了CMake的Nuget包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CMake生成C#WPF项目.我遵循了Github上的CMakeLists.txt 示例.

我的问题是:如何使用CMake向该项目添加Nuget包?

解决方案

CMake 3.15及更高版本支持使用

文档显示了如何通过用分号分隔; 软件包来添加多个 Nuget软件包.

对于较早的CMake版本,您可以在此处尝试建议的解决方法.

I am generating an C# WPF project using CMake. I followed this CMakeLists.txt example from Github.

My question is: How can add a Nuget package to this project using CMake?

解决方案

CMake 3.15 and above supports referencing Nuget packages with VS_PACKAGE_REFERENCES. To add a Nuget package reference to a CMake target, use the package name and package version separated by an underscore _. Here is an example for BouncyCastle version 1.8.5:

set_property(TARGET MyApplication
    PROPERTY VS_PACKAGE_REFERENCES "BouncyCastle_1.8.5"
)

The documentation shows how you can add multiple Nuget packages by semicolon-delimiting ; the packages.

For older CMake versions, you could try the proposed work-around suggested here.

这篇关于CMake的Nuget包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆