Nuget package from CMake

人走茶凉 提交于 2020-12-29 13:18:43

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/51400293/nuget-package-from-cmake

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!