设置CMake构建中的线程数 [英] Set the number of threads in a CMake build
本文介绍了设置CMake构建中的线程数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
cmake --build . --config Release
是否可以设置构建过程要使用的内核数量?
Is it possible to set the number of cores to be used by the build process?
我正在寻找类似于GNU make的 -j
选项的东西。
I'm looking for something similar to GNU make's -j
option.
推荐答案
根据发行说明,使用CMake 3.12可以跨平台完成:
According to the Release Notes, with CMake 3.12 it can be done cross-platform:
The
cmake(1)
构建工具模式(cmake –build
)获得了-平行[< jobs>]
和-j [< jobs>]
选项来指定并行构建级别。它们映射到本机构建工具的相应选项。
The
cmake(1)
Build Tool Mode (cmake –build
) gained--parallel [<jobs>]
and-j [<jobs>]
options to specify a parallel build level. They map to corresponding options of the native build tool.
这篇关于设置CMake构建中的线程数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文