CMake build parallel

CMake environment variable CMAKE_BUILD_PARALLEL_LEVEL can be manually set to control default number of build parallel threads. Parallel builds are virtually always desired to save build and rebuild time. As a starting point, perhaps set CMAKE_BUILD_PARALLEL_LEVEL environment variable to be equal to the number of physical or logical CPU cores by setting it in the user profile:

# Linux

# macOS
export CMAKE_BUILD_PARALLEL_LEVEL=$(sysctl -n hw.physicalcpu)

# Windows, in environment variable settings

export CMAKE_BUILD_PARALLEL_LEVEL=$(sysctl -n hw.ncpu)

If the computer runs out of RAM, reduce the specific command parallelism with the cmake --build --parallel N command line option. For Ninja build systems, specific targets can control the number of workers with job pools.