summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGhsMultiGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-04 12:37:18 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-04 13:44:08 (GMT)
commit69ee18163b9cf062d1306386b1bffceccdb24e3c (patch)
tree808def3f7a2596a05ae7074fc17b3925fd458104 /Source/cmLocalGhsMultiGenerator.cxx
parentc4e296a60910c641a07695d1a9782912bce45d5c (diff)
downloadCMake-69ee18163b9cf062d1306386b1bffceccdb24e3c.zip
CMake-69ee18163b9cf062d1306386b1bffceccdb24e3c.tar.gz
CMake-69ee18163b9cf062d1306386b1bffceccdb24e3c.tar.bz2
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.
Diffstat (limited to 'Source/cmLocalGhsMultiGenerator.cxx')
-rw-r--r--Source/cmLocalGhsMultiGenerator.cxx36
1 files changed, 8 insertions, 28 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 <algorithm>
#include <utility>
-
-#include <cmext/algorithm>
+#include <vector>
#include "cmGeneratorTarget.h"
#include "cmGhsMultiTargetGenerator.h"
@@ -29,34 +27,16 @@ std::string cmLocalGhsMultiGenerator::GetTargetDirectory(
return dir;
}
-void cmLocalGhsMultiGenerator::GenerateTargetsDepthFirst(
- cmGeneratorTarget* target, std::vector<cmGeneratorTarget*>& 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<cmGeneratorTarget*> 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();
}
}