【问题标题】:What is the meaning of -- -j 8 in cmake commandcmake命令中--j 8是什么意思
【发布时间】:2020-05-18 15:26:17
【问题描述】:

这是一个类似的问题:What does --target option mean in CMake?

但是那里的答案没有解释任何关于“--j 8”的内容。 它的实际作用是什么?

【问题讨论】:

标签: cmake


【解决方案1】:

-- 选项意味着将以下选项传递给原生工具,可能是make。对于make-j 选项表示要同时运行的作业数:

-j [jobs], --jobs[=jobs]
    Specifies the number of jobs (commands) to run simultaneously.  If there is more than one -j option, the
    last one is effective.  If the -j option is given without an argument, make will not limit the number of
    jobs that can run simultaneously.

这允许make 使用多个进程同时运行不同的构建步骤,可能会减少构建时间。

【讨论】:

    【解决方案2】:

    通常,make 一次只会执行一个配方,等待它完成后再执行下一个。但是,“-j”或“--jobs”选项告诉 make 同时执行许多配方。

    【讨论】:

      【解决方案3】:

      -j 选项告诉cmake 最多同时运行N 单独的作业。

      来自cmake build options

      构建时使用的最大并发进程数。

      【讨论】:

      • 虽然正确,但参考是针对 make,而不是 CMake。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-08
      • 2017-07-20
      • 2013-03-07
      • 2019-01-07
      • 1970-01-01
      相关资源
      最近更新 更多