--target选项在CMake中是什么意思? [英] What does --target option mean in CMake?

查看:1426
本文介绍了--target选项在CMake中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C:\blah\duh\bin\Android>"C:\Program Files (x86)\CMake\bin\cmake.exe" --build . --target SysTest --use-stderr -- -j 8    

我在CMake build命令上面有这个。我得到-build。将从当前目录中的Makefile生成。但是选项-目标SysTest -j 8 有什么作用?这是-build 的CMake文档,但我承认,我不理解-target 的用法

I have this above CMake build command. I get that --build . is going to build from the Makefile in the current directory. But what does the option --target SysTest and -j 8 do? Here is the CMake documentation for --build but I admit, I don't understand the use of --target.

 --build <dir>
Build a CMake-generated project binary tree.

This abstracts a native build tool’s command-line interface with the following options:

<dir>          = Project binary directory to be built.
--target <tgt> = Build <tgt> instead of default targets.
--config <cfg> = For multi-configuration tools, choose <cfg>.
--clean-first  = Build target 'clean' first, then build.
                 (To clean only, use --target 'clean'.)
--use-stderr   = Ignored.  Behavior is default in CMake >= 3.0.
--             = Pass remaining options to the native tool.


推荐答案

如果我有

add_executable(hello hello.cpp)

add_executable(goodbye goodbye.cpp)

然后CMake为每个可执行文件创建构建目标。它还会创建其他构建目标,例如 all构建目标,它会构建所有内容。

then CMake creates 'build targets' for each executable. It also creates other build targets, such as the 'all' build target, which builds everything.

默认情况下,如果未指定目标,则执行全部目标,这意味着将建立问候和告别。

By default, if the target is not specified, the 'all' target is executed, meaning both hello and goodbye are built.

如果只想构建目标之一,则可以指定要构建的目标。

You can specify the target to build if you only want to build one of them.

这篇关于--target选项在CMake中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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