Wednesday, October 5, 2022

[SOLVED] Set the number of threads in a CMake build

Issue

cmake --build . --config Release

Is it possible to set the number of cores to be used by the build process?

I'm looking for something similar to GNU make's -j option.


Solution

According to the Release Notes, with CMake 3.12 it can be done cross-platform:

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.



Answered By - usr1234567
Answer Checked By - Marie Seifert (WPSolving Admin)