With CMake 3.12 this is possible. From the release notes:
The
cmake(1)Build a Project (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.
As mentioned by dkg, you can also set the environment variable CMAKE_BUILD_PARALLEL_LEVEL.
Links to CMake’s documentation:
- Build a Project
- CMAKE_BUILD_PARALLEL_LEVEL