I want to include #define from the h file to parse all other files using Doxygen.
Project background
My C project includes the config.h header file on it with the build command.
It also defines the target MODEL_A in the same build command.
config.h creates determines depending on the created target (not the same lists for MODEL_A as for MODEL_B ):
#if defined(MODEL_A) #define HAS_FUNCTIONALITY_1 #define HAS_FUNCTIONALITY_2 #elif defined(MODEL_B) #define HAS_FUNCTIONALITY_3 #define HAS_FUNCTIONALITY_4 #endif
My problem with Doxygen:
I am trying to create documentation with Doxygen. I have a Doxyfile:
# including of config.h to INPUT seems necessary. INPUT = ./source/config.h \ ./source ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = NO INCLUDE_PATH = ./source INCLUDE_FILE_PATTERNS = ./source/config.h PREDEFINED = MODEL_A
Code that depends on HAS_FUNCTIONALITY_x definitions is not contained in the documentation, as if the preprocessor had not received the definition in config.h .
My results so far:
I checked the preprocessor output with doxygen -d Preprocessor and could see that:
- Was first analyzed
./source/config.h and correctly according to MODEL_A (I can see the correct #defines at the output of the preprocessor). #define HAS_FUNCTIONALITY_1 digits in the output of the preprocessor.- preprocessing C files that depend on
HAS_FUNCTIONALITY_1 acts as if it had not been defined.
The definition of HAS_FUNCTIONALITY_1 in the PREDEFINED field of the Doxyfile works as expected. This is not a practical solution, but still interesting.
How do I make sure that #define lines pre-processed from config.h remain defined when the preprocessor is running in all subsequent C files?
source share