选项“ --build” cmake的 [英] the option "--build" of cmake

查看:247
本文介绍了选项“ --build” cmake的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 cmake --build 命令来构建我的项目。

此命令的- config 选项。 我不知道可以分配多少个不同的参数。而且我发现cmake不会检查-config 的参数是否正确

I want to use the cmake --build command to build my project.
This command has a --config option. I don't know how many different parameters I can assign to. And I found cmake doesn't check if the parameter of --config is correct or not

推荐答案

您可以致电 cmake --build 像这样:

You can call cmake --build like this:

cmake --build . --target MyExe --config Debug

由于目录为作为传递。,并在 Debug MyExe

This would be run from your build root, since the directory is passed as ., and would build the target MyExe in Debug mode.

如果构建工具是多配置工具(例如Windows上的devenv),则-config 论点很重要。如果您在此处传递无效的参数作为配置类型,则构建工具会出现错误。

If your build tool is a multi-configuration one (like devenv on Windows), the --config argument matters. If you pass an invalid parameter as the config type here, the build tool should give an error.

如果构建工具不是多配置(例如gcc),那么-config 参数将被忽略。而是通过 CMAKE_BUILD_TYPE CMake变量来设置构建类型。也就是说,它是在运行CMake时设置的,而不是在运行构建工具时设置的。

If the build tool isn't multi-config (like gcc), then the --config argument is ignored. Instead the build type is set via the CMAKE_BUILD_TYPE CMake variable; i.e. it's set when running CMake, not when running the build tool.

您可以将其他选项传递给构建工具,方法是在<$ c $之后添加它们c>-,例如,如果使用gcc,则传递 -j4

You can pass further options to the build tool by adding them at the end after a --, e.g to pass -j4 if using gcc:

cmake --build . --target MyExe -- -j4

这篇关于选项“ --build” cmake的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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