cmake --build: Use a default parallel jobs if the `--parallel 0` was passed
Problem description
Just for now, CMake partially support of cmake --build --parallel
for calling native tool concurrency.
We aren't talking about passing the specific concurrency value, such as 1
or 42
. Just about giving chance to the native tool to determine the concurrency.
There are some cases how we can set the build concurrency just for now:
- From the CLI:
cmake --build --parallel
- it works - From the environment variable
CMAKE_BUILD_PARALLEL_LEVEL
:- on Windows via
set CMAKE_BUILD_PARALLEL_LEVEL=
call - doesn't work - on Linux via
export CMAKE_BUILD_PARALLEL_LEVEL=
- doesn't tested, shouldn't also work
- on Windows via
- From the
CMakePresets.json
file:- via the
jobs
parameter - doesn't possible, because it requires a number,0
value doesn't work - via
CMAKE_BUILD_PARALLEL_LEVEL
environment variable (environment
section) with""
(empty) value - doesn't work - via
CMAKE_BUILD_PARALLEL_LEVEL
environment variable (environment
section) withnull
(JSON null, not the string) value - doesn't work
- via the
So, we can set it only by manual pass --parallel
argument to the CMake, nothing else.
Test environment
- Windows 10 22H2 x64
-
Visual Studio 17 2022
generator - Native compiling (x64 to x64)
Proposal
Just to use 0
value for this case. It is not acceptable value for now, but we can reserve & use it for running native tool concurrency.