Silicomancer Silicomancer - 2 months ago 10
C Question

Document a config macro with doxygen

I want to document a configuration macro with doxygen. That macro is not defined in source code but is required to be defined using compiler definition settings.

Since I have no definition I tried something like the following which I found in the doxygen manual (I added this snippet to the header that is using the macro for conditional compilation):

/*! \def MY_CONFIG_MACRO
\brief Brief

Details.
*/


However that documentation does not appear in the generated HTML files. Any idea why the above doesn't work? How can I document a compiler defined macro in the context where it is used?

Answer

Got the very same problem, it was resolved like this:

In the doxygen configuration file, add:

PREDEFINED = IN_DOXYGEN

Somewhere in the source code, add:

/*
  Exporting cmake compilation flags to doxygen,
  so they get documented.
*/
#ifdef IN_DOXYGEN
#define MY_CONFIG_MACRO
#endif /* IN_DOXYGEN */

Then the documentation for MY_CONFIG_MACRO is picked up properly.

Comments