file(GLOB source_files *.gv)

set(outdir ${CMAKE_SOURCE_DIR}/hugo/static/img/auto/src_doc)
file(MAKE_DIRECTORY ${outdir})

set(outfiles "")
foreach(src ${source_files})
    get_filename_component(name ${src} NAME_WLE)
    set(outfile ${outdir}/${name}.svg)
    list(APPEND outfiles ${outfile})
    add_custom_command(
        OUTPUT ${outfile}
        DEPENDS ${src}
        COMMAND dot ${src} -Tsvg > ${outfile}
    )
endforeach()

add_custom_target(src_graphs DEPENDS ${outfiles})

add_dependencies(webdoc src_graphs)
