CMake和MsVS-NuGet [英] CMake and MsVS-NuGet

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

问题描述

我目前正在开发一个桌面应用程序,使用C ++ REST SDK(代号为Casablanca),Qt5和其他一些库。

I'm currently developing a desktop application, using the C++ REST SDK (codename Casablanca), Qt5 and some other libraries.

CMake。

如何获取CMake安装NuGet包?

How to get CMake to install NuGet Packages?

我现在必须手动安装,如果我重新运行CMake,这不是一个真正的选项。

I now have to install it each time manually, if I rerun CMake, which isn't really an option.

推荐答案

NuGet的命令行参考位于 http://docs.nuget.org/docs/reference/command-line-reference

The command line reference of NuGet is located at http://docs.nuget.org/docs/reference/command-line-reference

您可以使用 nuget install nuget restore 命令安装软件包。 nuget更新更新已安装的软件包( restore 必须运行beforhand)。

You can install packages using the nuget install or nuget restore command. nuget update updates the installed packages (restore must be run beforhand).

您可以使用以下命令指示cmake在每次构建之前运行NuGet:

You can instruct cmake to run NuGet before every build by using:

add_custom_command(TARGET ${PROJECT_NAME}
    PRE_BUILD
    COMMAND nuget restore ${CMAKE_BINARY_DIR}\yourSolution.sln
)


$ b b

或在配置时使用 execute_process

您可以使用<$ c准备nuget配置文件$ c> configure_file 或直接使用适当的 nuget install 命令。

You can prepare the nuget config file using configure_file or use appropriate nuget install commands directly.

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

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