Is it somehow possible to use doxygen to genererate CMake documentation?

I would like to use doxygen to generate documentation for .cmake files. I already added *.cmake \ to the Doxyfile ( Configuration for doxygen ) FILE_PATTERNS section, but it seems that doxygen cannot handle .cmake files.

test.cmake

#[==[
@ingroup module-impl
@brief Output a node in the graph

Queries the properties for modules and generates the node for it in the graph
and its outgoing dependency edges.
#]==]
function (_anyfunction var module)
endfunction()

use doxygen to genererate CMake documentation?

You know what has to be done. Download Doxygen source and implement the support for CMake syntax and parsing comments in CMake, just like it is implemented for other languages. See https://www.doxygen.nl/support.html .

There is no support for CMake at this time.

Is it somehow possible

Write basically a small compiler/parser, that takes CMake source code and transforms it to short C or Python or other programming language source code and then run Doxygen via generated files.

With the format presented, that would be a short script that searches for fuction(... lines, extracts the function name, extracts the comment before it, and generates // @brief-ish comments like comments followed by void _anyFunction();.


You could also do like:

FILE_PATTERNS = *.cmake
EXTENSION_MAPPING = cmake=C  # or Python or other

And then try to squeeze other programming language into CMake files:

#[=[*/
/// @function _anyFunction
/// @brief Output a node in the graph
///
/// Queries the properties for modules and generates the node for it in the graph
void _anyFunction();
#/*]=]
function (_anyfunction var module)
endfunction()