Is the --graphviz
option of CMake supposed to get the dependency on custom targets?
Sample CMakeLists.txt
file:
cmake_minimum_required(VERSION 2.8)
add_executable(target0 test.cpp)
add_dependencies(target0 target1)
add_custom_target(target1 ALL
COMMAND echo hello
)
The output file of "cmake --graphviz=test.dot ." would be:
digraph GG {
node [
fontsize = "12"
];
"node3" [ label="target0" shape="house"];
}
There isn't any trace of target1
.
The CMake manual clearly states:
--graphviz=[file]
Generate a graphviz input file that will contain all the library and executable dependencies in the project. See the documentation for CMakeGraphVizOptions.cmake for more details.
So, as far as I know, your custom target is neither - nor library, nor executable to be included into the resulting graph.
As some might stumble over this question.
With CMake 3.17 custom targets can now be included
https://cmake.org/cmake/help/v3.17/module/CMakeGraphVizOptions.html (related issue 17960)
GRAPHVIZ_CUSTOM_TARGETS
Set to TRUE to include custom targets in the generated graphs.
Mandatory: NO
Default: FALSEGRAPHVIZ_IGNORE_TARGETS
A list of regular expressions for names of targets to exclude from the generated graphs.
Mandatory: NO
Default: empty
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With