简体   繁体   English

来自 CMake 的 Nuget 包

[英]Nuget package from CMake

I am generating an C# WPF project using CMake.我正在使用 CMake 生成一个 C# WPF 项目。 I followed this CMakeLists.txt example from Github.我遵循了 Github 上的这个 CMakeLists.txt 示例

My question is: How can add a Nuget package to this project using CMake?我的问题是:如何使用 CMake 向该项目添加 Nuget 包?

CMake 3.15 and above supports referencing Nuget packages with VS_PACKAGE_REFERENCES . CMake 3.15 及更高版本支持使用VS_PACKAGE_REFERENCES引用 Nuget 包。 To add a Nuget package reference to a CMake target, use the package name and package version separated by an underscore _ .要将 Nuget 包引用添加到 CMake 目标,请使用由下划线_分隔的包名称和包版本。 Here is an example for BouncyCastle version 1.8.5:以下是BouncyCastle版本 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 ;该文档显示了如何通过分号分隔添加多个Nuget 包; the packages.包。

For older CMake versions, you could try the proposed work-around suggested here .对于较旧的 CMake 版本,您可以尝试此处建议的解决方法。

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

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