diff options
author | Stephan Rohmen <stephan@moduleworks.com> | 2020-08-17 12:26:05 (GMT) |
---|---|---|
committer | Stephan Rohmen <s.rohmen@gmx.de> | 2020-08-17 19:48:47 (GMT) |
commit | f7dd74e4efb9744dccec40406f146fbd031edef5 (patch) | |
tree | 75972bed1c4053f57ecd346ff9a0bf5aab016a85 /Source/cmGraphVizWriter.cxx | |
parent | 35d8543f2524d088ccbe7eb4a600f2c65d7f53d7 (diff) | |
download | CMake-f7dd74e4efb9744dccec40406f146fbd031edef5.zip CMake-f7dd74e4efb9744dccec40406f146fbd031edef5.tar.gz CMake-f7dd74e4efb9744dccec40406f146fbd031edef5.tar.bz2 |
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.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 570f4ea..8a7728e 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; } |