From 69ee18163b9cf062d1306386b1bffceccdb24e3c Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 4 Sep 2020 08:37:18 -0400 Subject: cmLocalGhsMultiGenerator: Generate targets in dependency order Use the globally computed target ordering so that we generate all of a target's dependencies before generating the target itself. --- Source/cmLocalGhsMultiGenerator.cxx | 36 ++++++++---------------------------- Source/cmLocalGhsMultiGenerator.h | 5 ----- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index a23ad57..b223813 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -2,10 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmLocalGhsMultiGenerator.h" -#include #include - -#include +#include #include "cmGeneratorTarget.h" #include "cmGhsMultiTargetGenerator.h" @@ -29,34 +27,16 @@ std::string cmLocalGhsMultiGenerator::GetTargetDirectory( return dir; } -void cmLocalGhsMultiGenerator::GenerateTargetsDepthFirst( - cmGeneratorTarget* target, std::vector& remaining) -{ - if (!target->IsInBuildSystem()) { - return; - } - // Find this target in the list of remaining targets. - auto it = std::find(remaining.begin(), remaining.end(), target); - if (it == remaining.end()) { - // This target was already handled. - return; - } - // Remove this target from the list of remaining targets because - // we are handling it now. - *it = nullptr; - - cmGhsMultiTargetGenerator tg(target); - tg.Generate(); -} - void cmLocalGhsMultiGenerator::Generate() { - std::vector remaining; - cm::append(remaining, this->GetGeneratorTargets()); - for (auto& t : remaining) { - if (t) { - this->GenerateTargetsDepthFirst(t, remaining); + for (cmGeneratorTarget* gt : + this->GlobalGenerator->GetLocalGeneratorTargetsInOrder(this)) { + if (!gt->IsInBuildSystem()) { + continue; } + + cmGhsMultiTargetGenerator tg(gt); + tg.Generate(); } } diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h index 1b6f109..be32a94 100644 --- a/Source/cmLocalGhsMultiGenerator.h +++ b/Source/cmLocalGhsMultiGenerator.h @@ -4,7 +4,6 @@ #include #include -#include #include "cmLocalGenerator.h" @@ -37,8 +36,4 @@ public: void ComputeObjectFilenames( std::map& mapping, cmGeneratorTarget const* gt = nullptr) override; - -private: - void GenerateTargetsDepthFirst(cmGeneratorTarget* target, - std::vector& remaining); }; -- cgit v0.12