summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorMartin Duffy <martin.duffy@kitware.com>2024-05-22 20:08:54 (GMT)
committerMartin Duffy <martin.duffy@kitware.com>2024-05-23 13:54:19 (GMT)
commit0e5250e63c5c82ff0c8b52ade9c2f84fbe251152 (patch)
tree0422addf568db0beac59800fe1cc5578fb74e09f /Source/cmGlobalNinjaGenerator.cxx
parentdaeb8fffa2d30cf6737c60f22c151d10581783ac (diff)
downloadCMake-0e5250e63c5c82ff0c8b52ade9c2f84fbe251152.zip
CMake-0e5250e63c5c82ff0c8b52ade9c2f84fbe251152.tar.gz
CMake-0e5250e63c5c82ff0c8b52ade9c2f84fbe251152.tar.bz2
Ninja: Add option for parallel install
Adds the global property ``INSTALL_PARALLEL`` to enable a parallel install target for Ninja. Fixes: #25459
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 612af4f..7468572 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1835,6 +1835,21 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
if (!this->DefaultFileConfig.empty()) {
this->WriteTargetDefault(*this->GetDefaultFileStream());
}
+
+ if (this->InstallTargetEnabled &&
+ this->GetCMakeInstance()->GetState()->GetGlobalPropertyAsBool(
+ "INSTALL_PARALLEL") &&
+ !this->Makefiles[0]->IsOn("CMAKE_SKIP_INSTALL_RULES")) {
+ cmNinjaBuild build("phony");
+ build.Comment = "Install every subdirectory in parallel";
+ build.Outputs.emplace_back(this->GetInstallParallelTargetName());
+ for (auto const& mf : this->Makefiles) {
+ build.ExplicitDeps.emplace_back(
+ this->ConvertToNinjaPath(cmStrCat(mf->GetCurrentBinaryDirectory(), "/",
+ this->GetInstallLocalTargetName())));
+ }
+ WriteBuild(os, build);
+ }
}
void cmGlobalNinjaGenerator::WriteTargetDefault(std::ostream& os)