Graphviz: Fix bug that shows duplicated alias targets

When using subdirectories the alias targets were duplicated
This commit is contained in:
Stephan Rohmen 2020-08-17 14:26:05 +02:00 committed by Stephan Rohmen
parent 35d8543f25
commit f7dd74e4ef
19 changed files with 33 additions and 3 deletions

View File

@ -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;
}

View File

@ -64,3 +64,5 @@ target_link_libraries(ConsoleApplication CryptoCurrencyMiningLibrary)
add_custom_target(GenerateManPage COMMAND ${CMAKE_COMMAND} --version)
add_dependencies(ConsoleApplication GenerateManPage)
add_subdirectory(sub_directory_target)

View File

@ -52,4 +52,5 @@ subgraph clusterLegend {
"node12" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node12" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node12" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node13" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -50,4 +50,5 @@ subgraph clusterLegend {
"node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node12" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -50,4 +50,5 @@ subgraph clusterLegend {
"node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node12" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -46,4 +46,5 @@ subgraph clusterLegend {
"node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node10" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -35,4 +35,5 @@ subgraph clusterLegend {
"node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ];
"node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary
"node6" [ label = "\"-lm\"", shape = septagon ];
"node7" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -43,4 +43,5 @@ subgraph clusterLegend {
"node8" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary
"node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node9" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node10" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -44,4 +44,5 @@ subgraph clusterLegend {
"node9" [ label = "GraphicLibraryObjects", shape = hexagon ];
"node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects
"node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary
"node10" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -48,4 +48,5 @@ subgraph clusterLegend {
"node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node11" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -50,4 +50,5 @@ subgraph clusterLegend {
"node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node12" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -44,4 +44,5 @@ subgraph clusterLegend {
"node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node11" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -39,4 +39,5 @@ subgraph clusterLegend {
"node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags
"node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node10" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -48,4 +48,5 @@ subgraph clusterLegend {
"node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node11" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -50,4 +50,5 @@ subgraph clusterLegend {
"node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node12" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -50,4 +50,5 @@ subgraph clusterLegend {
"node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"node12" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -50,4 +50,5 @@ subgraph clusterLegend {
"point11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ];
"point11" -> "point0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags
"point11" -> "point2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary
"point12" [ label = "SubDirectoryTarget", shape = egg ];
}

View File

@ -0,0 +1 @@
add_executable(SubDirectoryTarget test.c)

View File

@ -0,0 +1,4 @@
int main(int argc, char** argv)
{
return 0;
}