This adds the target `target-graphs` that generated graphs of cmake dependencies based on `cmake --graphviz`. It is a nice to tool to debug the cmake setup in some cases.
add_subdirectory(test)
+include(target-graphs)
+
#-----------------------------------------------------------------------------#
# Package configuration
#
--- /dev/null
+###############################################################################
+# Top contributors (to current version):
+# Gereon Kremer
+#
+# This file is part of the cvc5 project.
+#
+# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
+# in the top-level source directory and their institutional affiliations.
+# All rights reserved. See the file COPYING in the top-level source
+# directory for licensing information.
+# #############################################################################
+# Configuration file for the generation of cmake dependency graphs of cmake
+# targets.
+##
+
+set(CTX "@CMAKE_BINARY_DIR@/src/context/CMakeFiles/cvc5base.dir/")
+set(BASE "@CMAKE_BINARY_DIR@/src/base/CMakeFiles/cvc5base.dir/")
+
+# ignore targets that do not actually help the understanding or are (usually)
+# not interesting: tests and object files.
+set(GRAPHVIZ_IGNORE_TARGETS
+ main-test
+ @APITESTS@
+ ${CTX}context.cpp.o ${CTX}context_mm.cpp.o
+ ${BASE}check.cpp.o ${BASE}configuration.cpp.o ${BASE}exception.cpp.o
+ ${BASE}git_versioninfo.cpp.o ${BASE}listener.cpp.o ${BASE}output.cpp.o
+)
+set(GRAPHVIZ_GENERATE_DEPENDERS FALSE)
\ No newline at end of file
--- /dev/null
+###############################################################################
+# Top contributors (to current version):
+# Gereon Kremer
+#
+# This file is part of the cvc5 project.
+#
+# Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
+# in the top-level source directory and their institutional affiliations.
+# All rights reserved. See the file COPYING in the top-level source
+# directory for licensing information.
+# #############################################################################
+# Provides cmake target target-graphs with generates (png) dependency graphs
+# to visualize the interdependencies of all cmake targets.
+##
+
+get_target_property(APITESTS build-apitests MANUALLY_ADDED_DEPENDENCIES)
+string(REPLACE ";" " " APITESTS "${APITESTS}")
+
+configure_file(
+ cmake/CMakeGraphVizOptions.cmake.in
+ ${CMAKE_BINARY_DIR}/CMakeGraphVizOptions.cmake
+ @ONLY
+)
+
+add_custom_target(target-graphs
+ COMMAND
+ ${CMAKE_COMMAND} --graphviz=target-graphs/graph.dot ${CMAKE_SOURCE_DIR}
+ COMMAND
+ find target-graphs/ -iname "graph.dot*" -and \! -iname "*.png"
+ -exec dot -Tpng -O {} +
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+)