graphviz: cmake 3.17 has problem with cyclic dependencies of size 2
Hi I think I hit a regression in cmake 3.17. 3.16 worked fine. When project has two static libs that are mutually dependent, dependencies graph doesn't show the cycle. Consider:
project(FooProject CXX)
add_library (duoA STATIC empty.cpp)
add_library (duoB STATIC empty.cpp)
target_link_libraries(duoA PUBLIC duoB)
target_link_libraries(duoB PUBLIC duoA)
add_library (trioA STATIC empty.cpp)
add_library (trioB STATIC empty.cpp)
add_library (trioC STATIC empty.cpp)
target_link_libraries(trioA PUBLIC trioB)
target_link_libraries(trioB PUBLIC trioC)
target_link_libraries(trioC PUBLIC trioA)
add_library (motherA STATIC empty.cpp)
add_library (motherB STATIC empty.cpp)
target_link_libraries(motherA PUBLIC trioA)
target_link_libraries(motherB PUBLIC trioB)
target_link_libraries(motherA PUBLIC duoA)
target_link_libraries(motherB PUBLIC duoB)
cmake .. --graphviz=deps.dot
creates this (legent cut out for brevity):
digraph "FooProject" {
node [
fontsize = "12"
];
"node0" [ label = "duoA", shape = octagon ];
"node1" [ label = "duoB", shape = octagon ];
"node1" -> "node0" // duoB -> duoA
"node2" [ label = "motherA", shape = octagon ];
"node2" -> "node0" // motherA -> duoA
"node3" [ label = "trioA", shape = octagon ];
"node4" [ label = "trioB", shape = octagon ];
"node5" [ label = "trioC", shape = octagon ];
"node5" -> "node3" // trioC -> trioA
"node3" -> "node4" // trioA -> trioB
"node4" -> "node5" // trioB -> trioC
"node2" -> "node3" // motherA -> trioA
"node6" [ label = "motherB", shape = octagon ];
"node6" -> "node1" // motherB -> duoB
"node6" -> "node4" // motherB -> trioB
}
for duoA
-> duoB
-> duoA
, graph misses duoA
.
Cycle of size 3 work fine (trioA,B,C), only size 2 is wrong.
The same thing happens on Ninja and Makefile. As far as I am able to parse build.ninja, it has the same problem as graph.
My system:
- cmake version 3.17.5
- Ubuntu 18.04.4 LTS
- ninja 1.8.2
Edited by Brad King