mercredi 31 août 2016

Use Macro to add entities to doxygen group

In a very large code base I want to automatically add classes and functions to groups based on the project they are defined in. Luckily, I already have a compiler macro PROJECT_NAME_EXPORTED appended to each exported function and class:

enum PROJECT_NAME_EXPORTED MyEnum {}
class PROJECT_NAME_EXPORTED MyClass {}
PROJECT_NAME_EXPORTED void myFunction(int a)

The macro follows the same convention but is different for every subproject, e.g. SOME_PROJECT_EXPORTED, OTHER_EXPORTED. So having a list of all projects I do the following in my doxygen's CMake:

foreach(name ${LIST_OF_PROJECTS})
    SET(DOXYGEN_PREDEFINED_MACROS "${DOXYGEN_PREDEFINED_MACROS}\"${name}_EXPORTED=(void)/** @ingroup ${name}*/\" \\ \n")
endforeach()

And this almost works, the classes are listed correctly but the functions are listed with two return types (the actual one and the (void) I injected above):

void void myFunction(int a)

The culprit is obviously said injected (void) but if I leave it out, the classes are not correctly added to the group anymore.

Is there a different "dummy" word to add here or an entirely different solution for automatically adding all entities in a project to the corresponding doxygen group?

Aucun commentaire:

Enregistrer un commentaire