You are right as already given here: Cmake parallel build - #8 by erk
however @ProTur1 is seeking a CMake variable to be set in CMakeLists.txt not an environment variable.
I don’t personally know why this feature does not exist, may be you can try to implement it and see by yourself.
My very personal opinion is that I don’t want the provider of a project to enforce a level of parallelism on my build, if want to build with full parallelism I use ninja generator. If I want to chose a constrained parallelism I build with cmake --build --parallel <myChoice>
.
The level of parallelism I want depends on various thing the developer of the project cannot know:
- Am I building on my dev machine or in CI ?
- Is my dev machine equipped with 4, 8 or 32 cores?
- Is the build machine dedicated to that build or shall this build be a background activity which leaves enough computing power/RAM/disk activities etc… to other processes ?
…
So I don’t know why this feature does not exist but my personal opinion is AFAIK I won’t need it anytime soon.
May be you could explain why, in your point of view this is a desirable/useful feature?