summaryrefslogtreecommitdiff
path: root/Source/cmLocalVisualStudio10Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-03 15:09:19 -0400
committerBrad King <brad.king@kitware.com>2020-09-04 09:44:30 -0400
commit152724274534def1126f97a28f0ce9f0e126a2b2 (patch)
treea41ca387a2fdf1f948ec04ba9abf011030a0bb52 /Source/cmLocalVisualStudio10Generator.cxx
parent48bf7192e702f9fdc99585e3d9d616091cc62974 (diff)
downloadcmake-152724274534def1126f97a28f0ce9f0e126a2b2.tar.gz
cmLocalVisualStudio10Generator: Simplify target ordering by dependencies
Replace our own depth-first traversal with use of the global generator's computed target order that respects dependencies.
Diffstat (limited to 'Source/cmLocalVisualStudio10Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx29
1 files changed, 7 insertions, 22 deletions
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 6c7d6c6c45..9706f2e7d0 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -66,29 +66,17 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
{
}
-void cmLocalVisualStudio10Generator::GenerateTargetsDepthFirst(
- cmGeneratorTarget* target, std::vector<cmGeneratorTarget*>& remaining)
+void cmLocalVisualStudio10Generator::GenerateTarget(cmGeneratorTarget* target)
{
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;
+ auto& targetVisited = this->GetSourcesVisited(target);
auto& deps = this->GlobalGenerator->GetTargetDirectDepends(target);
for (auto& d : deps) {
- // FIXME: Revise CreateSingleVCProj so we do not have to drop `const` here.
- auto dependee = const_cast<cmGeneratorTarget*>(&*d);
- GenerateTargetsDepthFirst(dependee, remaining);
// Take the union of visited source files of custom commands
- auto visited = GetSourcesVisited(dependee);
- GetSourcesVisited(target).insert(visited.begin(), visited.end());
+ auto depVisited = this->GetSourcesVisited(d);
+ targetVisited.insert(depVisited.begin(), depVisited.end());
}
if (static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
->TargetIsFortranOnly(target)) {
@@ -104,12 +92,9 @@ void cmLocalVisualStudio10Generator::GenerateTargetsDepthFirst(
void cmLocalVisualStudio10Generator::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)) {
+ this->GenerateTarget(gt);
}
this->WriteStampFiles();
}