【问题标题】:What does --target option mean in CMake?CMake 中的 --target 选项是什么意思?
【发布时间】:2014-09-17 17:18:59
【问题描述】:
C:\blah\duh\bin\Android>"C:\Program Files (x86)\CMake\bin\cmake.exe" --build . --target SysTest --use-stderr -- -j 8    

我有这个上面的 CMake 构建命令。我知道--build . 将从当前目录中的 Makefile 构建。但是选项--target SysTest 和-j 8 有什么作用?这是--build 的CMake 文档,但我承认,我不明白--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.

【问题讨论】:

  • -j8 是您允许构建使用的作业数

标签: cmake


【解决方案1】:

如果我有

add_executable(hello hello.cpp)

add_executable(goodbye goodbye.cpp)

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

默认情况下,如果未指定目标,则执行“all”目标,即构建 hello 和 goodbye。

如果您只想构建其中一个,您可以指定要构建的目标。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-30
    • 1970-01-01
    相关资源
    最近更新 更多