The way forward could be to:
-
Use CMake 3.11 to benefit from this fix: Ninja: add CMAKE_JOB_POOLS variable as default for JOBS_POOLS
-
Improve ExternalProjectDependency (and update the version of the module user in Slicer and CTK) so that it pass the variables
CMAKE_JOB_POOLS
,CMAKE_JOB_POOL_COMPILE
andCMAKE_JOB_POOL_LINK
to any CMake based external project project if their are set.
You could then configure the top-level project using -DCMAKE_JOB_POOLS:STRING=compile=5;link=2
.
This would mean that each instance of ninja would be limited to 5 compile jobs and 2 linker job.
Would that be helpful ? It may be worth exploring what would be sensible setup for Slicer.