diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-05-22 15:59:17 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-05-22 17:15:50 (GMT) |
commit | dddb4f02f74a2ffe550e0b2404504d657358b69a (patch) | |
tree | 93bf0fc82a5e4bbb8ba66919ca8bb9f4b8d8341a /Source/cmLocalNinjaGenerator.cxx | |
parent | 0c557a0cab681b17dbd4ed06f7776459880a90ea (diff) | |
download | CMake-dddb4f02f74a2ffe550e0b2404504d657358b69a.zip CMake-dddb4f02f74a2ffe550e0b2404504d657358b69a.tar.gz CMake-dddb4f02f74a2ffe550e0b2404504d657358b69a.tar.bz2 |
Ninja Multi-Config: Make "install" targets depend on default configs
And add an "install:all" target.
Fixes: #20713
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
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(""); |