Last active
July 7, 2020 13:46
-
-
Save agutenkunst/d0ee60a35e76f77e8c938ff88fcf089c to your computer and use it in GitHub Desktop.
Show cmake target dependency graph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
cmake src/<package_name>/ --graphviz=foo.dot | |
xdot foo.dot | |
``` | |
Set options for better exclude by adding a file src/<package_name>/CMakeGraphVizOptions.cmake with | |
``` | |
set(GRAPHVIZ_EXTERNAL_LIBS FALSE) | |
set(GRAPHVIZ_IGNORE_TARGETS "gtest;gmock;unittest*;integrationtest*") | |
``` | |
Or Filter: | |
``` | |
sed -i '/\/usr\/lib/d' foo.dot | |
sed -i '/\/opt\/ros/d' foo.dot | |
sed -i '/unittest/d' foo.dot | |
sed -i '/integrationtest/d' foo.dot | |
``` | |
## Include Custom Targets (needs CMake 3.18 -> NOT tried yet: https://askubuntu.com/questions/829310/how-to-upgrade-cmake-in-ubuntu) | |
``` | |
set(GRAPHVIZ_EXTERNAL_LIBS FALSE) | |
set(GRAPHVIZ_IGNORE_TARGETS "gtest;gmock;unittest*;integrationtest*") | |
set(GRAPHVIZ_CUSTOM_TARGETS TRUE) | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment