diff options
author | Brad King <brad.king@kitware.com> | 2020-05-25 14:33:17 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-05-25 14:33:26 (GMT) |
commit | f0ff991e427bd29ba5789b526d64b4876964c74f (patch) | |
tree | adec9ea171aea88550abf206c29c22448f04b5c1 /Source | |
parent | 0781540a80cfc7b15b1ebc1b60afe34f22f247e0 (diff) | |
parent | dddb4f02f74a2ffe550e0b2404504d657358b69a (diff) | |
download | CMake-f0ff991e427bd29ba5789b526d64b4876964c74f.zip CMake-f0ff991e427bd29ba5789b526d64b4876964c74f.tar.gz CMake-f0ff991e427bd29ba5789b526d64b4876964c74f.tar.bz2 |
Merge topic 'ninja-multi-install' into release-3.17
dddb4f02f7 Ninja Multi-Config: Make "install" targets depend on default configs
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4778
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 5 | ||||
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 37 | ||||
-rw-r--r-- | Source/cmNinjaUtilityTargetGenerator.cxx | 5 |
3 files changed, 42 insertions, 5 deletions
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index b89fb8f..44e632f 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -415,6 +415,11 @@ public: std::set<std::string> GetCrossConfigs(const std::string& config) const; + const std::set<std::string>& GetDefaultConfigs() const + { + return this->DefaultConfigs; + } + protected: void Generate() override; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index be1dd0d..56e9f81 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -97,6 +97,43 @@ void cmLocalNinjaGenerator::Generate() if (target->Target->IsPerConfig()) { for (auto const& config : this->GetConfigNames()) { tg->Generate(config); + if (target->GetType() == cmStateEnums::GLOBAL_TARGET && + this->GetGlobalGenerator()->IsMultiConfig()) { + cmNinjaBuild phonyAlias("phony"); + this->GetGlobalNinjaGenerator()->AppendTargetOutputs( + target.get(), phonyAlias.Outputs, ""); + this->GetGlobalNinjaGenerator()->AppendTargetOutputs( + target.get(), phonyAlias.ExplicitDeps, config); + this->GetGlobalNinjaGenerator()->WriteBuild( + *this->GetGlobalNinjaGenerator()->GetConfigFileStream(config), + phonyAlias); + } + } + if (target->GetType() == cmStateEnums::GLOBAL_TARGET && + this->GetGlobalGenerator()->IsMultiConfig()) { + if (!this->GetGlobalNinjaGenerator()->GetDefaultConfigs().empty()) { + cmNinjaBuild phonyAlias("phony"); + this->GetGlobalNinjaGenerator()->AppendTargetOutputs( + target.get(), phonyAlias.Outputs, ""); + for (auto const& config : + this->GetGlobalNinjaGenerator()->GetDefaultConfigs()) { + this->GetGlobalNinjaGenerator()->AppendTargetOutputs( + target.get(), phonyAlias.ExplicitDeps, config); + } + this->GetGlobalNinjaGenerator()->WriteBuild( + *this->GetGlobalNinjaGenerator()->GetDefaultFileStream(), + phonyAlias); + } + cmNinjaBuild phonyAlias("phony"); + this->GetGlobalNinjaGenerator()->AppendTargetOutputs( + target.get(), phonyAlias.Outputs, "all"); + for (auto const& config : this->GetConfigNames()) { + this->GetGlobalNinjaGenerator()->AppendTargetOutputs( + target.get(), phonyAlias.ExplicitDeps, config); + } + this->GetGlobalNinjaGenerator()->WriteBuild( + *this->GetGlobalNinjaGenerator()->GetDefaultFileStream(), + phonyAlias); } } else { tg->Generate(""); diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index a42d65d..6e39242 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -160,10 +160,5 @@ void cmNinjaUtilityTargetGenerator::Generate(const std::string& config) // be per-directory and have one at the top-level anyway. if (genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) { gg->AddTargetAlias(this->GetTargetName(), genTarget, config); - } else if (gg->IsMultiConfig() && genTarget->Target->IsPerConfig()) { - cmNinjaBuild phonyAlias("phony"); - gg->AppendTargetOutputs(genTarget, phonyAlias.Outputs, ""); - phonyAlias.ExplicitDeps = phonyBuild.Outputs; - gg->WriteBuild(this->GetImplFileStream(config), phonyAlias); } } |