# Graphviz, how to configure graphviz options?

**URL:** https://discourse.cmake.org/t/graphviz-how-to-configure-graphviz-options/12938
**Category:** Usage
**Created:** [November 11, 2024, 11:17am UTC](https://discourse.cmake.org/t/graphviz-how-to-configure-graphviz-options/12938 "2024-11-11T11:17:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![MickeJ](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/a5b964/32.png) [@MickeJ](https://discourse.cmake.org/u/MickeJ)
#### Post date: [November 11, 2024, 11:17am UTC](https://discourse.cmake.org/t/graphviz-how-to-configure-graphviz-options/12938/1 "2024-11-11T11:17:17Z")

</div>

Hi. I can not get [Graphviz options](https://cmake.org/cmake/help/latest/module/CMakeGraphVizOptions.html) to work. I generate a graph using a custom module below, and executing the target produces a png graph.

```auto
include_guard(GLOBAL)
add_custom_target(graphviz ALL
    COMMAND ${CMAKE_COMMAND} "--graphviz=graphviz/${PROJECT_NAME}.dot" .
    COMMAND dot -Tpng graphviz/${PROJECT_NAME}.dot -o graphviz/${PROJECT_NAME}.png
        BYPRODUCTS graphviz/*
    WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
    COMMENT "Creates a project dependency graph as png, located under: build${CMAKE_BINARY_DIR}/graphviz")

```

CMakeGraphVizOptions.cmake

```auto
GRAPHVIZ_GRAPH_HEADER ("test")

```

The error: `CMake Error at /home/user/CMakeGraphVizOptions.cmake:1 (GRAPHVIZ_GRAPH_HEADER): Unknown CMake command "GRAPHVIZ_GRAPH_HEADER".`

How can i set options?

What would be nice if graphviz options could be set like below, but it does not work.

```auto
set_target_properties(graphviz PROPERTIES GRAPHVIZ_GRAPH_NAME "test")

```

---

<div class="post-metadata">

### Author: ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)
#### Post date: [November 11, 2024, 12:51pm UTC](https://discourse.cmake.org/t/graphviz-how-to-configure-graphviz-options/12938/2 "2024-11-11T12:51:23Z")

</div>

As the docs say, the file `CMakeGraphVizOptions.cmake` can control Graphviz by setting CMake variables. So what you were after is this:

```auto
set(GRAPHVIZ_GRAPH_HEADER "test")

```
