Ninja: Add option for parallel install

Adds the global property ``INSTALL_PARALLEL`` to enable a parallel install
target for Ninja.

Fixes: #25459
This commit is contained in:
Martin Duffy
2024-05-22 16:08:54 -04:00
parent daeb8fffa2
commit 0e5250e63c
20 changed files with 135 additions and 4 deletions
+7
View File
@@ -24,6 +24,13 @@ Builtin Targets
The ``CMAKE_STRIP`` variable will contain the platform's ``strip`` utility, which
removes symbols information from generated binaries.
``install/parallel``
.. versionadded:: 3.30
Created only if the :prop_gbl:`INSTALL_PARALLEL` global property is ``ON``.
Runs the install step for each subdirectory independently and in parallel.
For each subdirectory ``sub/dir`` of the project, additional targets
are generated:
+1
View File
@@ -39,6 +39,7 @@ Properties of Global Scope
/prop_gbl/GENERATOR_IS_MULTI_CONFIG
/prop_gbl/GLOBAL_DEPENDS_DEBUG_MODE
/prop_gbl/GLOBAL_DEPENDS_NO_CYCLES
/prop_gbl/INSTALL_PARALLEL
/prop_gbl/IN_TRY_COMPILE
/prop_gbl/JOB_POOLS
/prop_gbl/PACKAGES_FOUND
+23
View File
@@ -0,0 +1,23 @@
INSTALL_PARALLEL
----------------
.. versionadded:: 3.30
Enables parallel installation option for the Ninja generator.
When this property is ``ON``, ``install/local`` targets have the
console pool disabled, allowing them to run concurrently.
This property also provides the target ``install/parallel``, which has an
explicit dependency on the ``install/local`` target for each subdirectory,
recursing down the project.
Setting this property has no affect on the behavior of ``cmake --install``.
The install must be invoked by building the ``install/parallel`` target
directly.
Calls to :command:`install(CODE)` or :command:`install(SCRIPT)` might depend
on actions performed by an earlier :command:`install` command in a different
directory such as files installed or variable settings. If the project has
such order-dependent installation logic, parallel installation should be
not be enabled, in order to prevent possible race conditions.