cmake/Modules/CMakeGraphVizOptions.cmake

151 lines
3.7 KiB
CMake
Raw Normal View History

2016-10-30 18:24:19 +01:00
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
2019-11-11 23:01:05 +01:00
#[=======================================================================[.rst:
CMakeGraphVizOptions
--------------------
2020-08-30 11:54:41 +02:00
The builtin Graphviz support of CMake.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
Generating Graphviz files
^^^^^^^^^^^^^^^^^^^^^^^^^
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
CMake can generate `Graphviz <https://www.graphviz.org/>`_ files showing the
dependencies between the targets in a project, as well as external libraries
which are linked against.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
When running CMake with the ``--graphviz=foo.dot`` option, it produces:
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
* a ``foo.dot`` file, showing all dependencies in the project
* a ``foo.dot.<target>`` file for each target, showing on which other targets
it depends
* a ``foo.dot.<target>.dependers`` file for each target, showing which other
targets depend on it
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
Those .dot files can be converted to images using the *dot* command from the
Graphviz package:
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
.. code-block:: shell
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
dot -Tpng -o foo.png foo.dot
2019-11-11 23:01:05 +01:00
2021-09-14 00:13:48 +02:00
.. versionadded:: 3.10
The different dependency types ``PUBLIC``, ``INTERFACE`` and ``PRIVATE``
are represented as solid, dashed and dotted edges.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
Variables specific to the Graphviz support
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
The resulting graphs can be huge. The look and content of the generated graphs
can be controlled using the file ``CMakeGraphVizOptions.cmake``. This file is
first searched in :variable:`CMAKE_BINARY_DIR`, and then in
:variable:`CMAKE_SOURCE_DIR`. If found, the variables set in it are used to
adjust options for the generated Graphviz files.
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_GRAPH_NAME
The graph name.
2020-08-30 11:54:41 +02:00
* Mandatory: NO
* Default: value of :variable:`CMAKE_PROJECT_NAME`
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_GRAPH_HEADER
2020-08-30 11:54:41 +02:00
The header written at the top of the Graphviz files.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
* Mandatory: NO
* Default: "node [ fontsize = "12" ];"
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_NODE_PREFIX
2020-08-30 11:54:41 +02:00
The prefix for each node in the Graphviz files.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
* Mandatory: NO
* Default: "node"
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_EXECUTABLES
2020-08-30 11:54:41 +02:00
Set to FALSE to exclude executables from the generated graphs.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
* Mandatory: NO
* Default: TRUE
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_STATIC_LIBS
2020-08-30 11:54:41 +02:00
Set to FALSE to exclude static libraries from the generated graphs.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
* Mandatory: NO
* Default: TRUE
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_SHARED_LIBS
2020-08-30 11:54:41 +02:00
Set to FALSE to exclude shared libraries from the generated graphs.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
* Mandatory: NO
* Default: TRUE
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_MODULE_LIBS
2020-08-30 11:54:41 +02:00
Set to FALSE to exclude module libraries from the generated graphs.
* Mandatory: NO
* Default: TRUE
.. variable:: GRAPHVIZ_INTERFACE_LIBS
Set to FALSE to exclude interface libraries from the generated graphs.
* Mandatory: NO
* Default: TRUE
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
.. variable:: GRAPHVIZ_OBJECT_LIBS
Set to FALSE to exclude object libraries from the generated graphs.
* Mandatory: NO
* Default: TRUE
.. variable:: GRAPHVIZ_UNKNOWN_LIBS
Set to FALSE to exclude unknown libraries from the generated graphs.
* Mandatory: NO
* Default: TRUE
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_EXTERNAL_LIBS
2020-08-30 11:54:41 +02:00
Set to FALSE to exclude external libraries from the generated graphs.
* Mandatory: NO
* Default: TRUE
.. variable:: GRAPHVIZ_CUSTOM_TARGETS
Set to TRUE to include custom targets in the generated graphs.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
* Mandatory: NO
* Default: FALSE
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_IGNORE_TARGETS
2020-08-30 11:54:41 +02:00
A list of regular expressions for names of targets to exclude from the
generated graphs.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
* Mandatory: NO
* Default: empty
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_GENERATE_PER_TARGET
2020-08-30 11:54:41 +02:00
Set to FALSE to not generate per-target graphs ``foo.dot.<target>``.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
* Mandatory: NO
* Default: TRUE
2019-11-11 23:01:05 +01:00
.. variable:: GRAPHVIZ_GENERATE_DEPENDERS
2020-08-30 11:54:41 +02:00
Set to FALSE to not generate depender graphs ``foo.dot.<target>.dependers``.
2019-11-11 23:01:05 +01:00
2020-08-30 11:54:41 +02:00
* Mandatory: NO
* Default: TRUE
2019-11-11 23:01:05 +01:00
#]=======================================================================]