summaryrefslogtreecommitdiff
path: root/Source/cmGraphVizWriter.cxx
diff options
context:
space:
mode:
authorStephan Rohmen <stephan@moduleworks.com>2020-08-17 14:26:05 +0200
committerStephan Rohmen <s.rohmen@gmx.de>2020-08-17 21:48:47 +0200
commitf7dd74e4efb9744dccec40406f146fbd031edef5 (patch)
tree75972bed1c4053f57ecd346ff9a0bf5aab016a85 /Source/cmGraphVizWriter.cxx
parent35d8543f2524d088ccbe7eb4a600f2c65d7f53d7 (diff)
downloadcmake-f7dd74e4efb9744dccec40406f146fbd031edef5.tar.gz
Graphviz: Fix bug that shows duplicated alias targets
When using subdirectories the alias targets were duplicated
Diffstat (limited to 'Source/cmGraphVizWriter.cxx')
-rw-r--r--Source/cmGraphVizWriter.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 570f4ea4b8..8a7728e767 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGraphVizWriter.h"
+#include <algorithm>
#include <cctype>
#include <iostream>
#include <memory>
@@ -552,16 +553,23 @@ bool cmGraphVizWriter::TargetTypeEnabled(
std::string cmGraphVizWriter::ItemNameWithAliases(
std::string const& itemName) const
{
- auto nameWithAliases = itemName;
-
+ std::vector<std::string> items;
for (auto const& lg : this->GlobalGenerator->GetLocalGenerators()) {
for (auto const& aliasTargets : lg->GetMakefile()->GetAliasTargets()) {
if (aliasTargets.second == itemName) {
- nameWithAliases += "\\n(" + aliasTargets.first + ")";
+ items.push_back(aliasTargets.first);
}
}
}
+ std::sort(items.begin(), items.end());
+ items.erase(std::unique(items.begin(), items.end()), items.end());
+
+ auto nameWithAliases = itemName;
+ for(auto const& item : items) {
+ nameWithAliases += "\\n(" + item + ")";
+ }
+
return nameWithAliases;
}