title: Prepend a particular header file to each documented *.c file
body: <p>So i have a small project, a bunch of *.c, *.h files. There are many compile-time switches in the form of #define statements in a config file which enable/disable particular functionality. So the file settings.h might contain</p>
  
  <pre><code>#define ENABLE_THIS_FEATURE  1
  #define ENABLE_THAT_FEATURE  0
  #define THAT_BUFFER_SIZE   128
  </code></pre>
  
  <p>Now the trick is, that settings file is not explicitely <code>#include</code>d by each compilation unit. Rather, it is prepended to each compilation with gcc's -imacros switch, like <code>gcc -imacros settings.h -o module.o module.c</code>.</p>
  
  <p>And now I want the settings file also have prepended when running doxygen on the source, so that it generates doc for exactly the enabled functionality. Although that file itself is processed by Doxygen normally (it's just another file in the source tree), the macro definitions therein do not take effect; it seems, each file is evaluated separately (which is certainly the wise thing to do).</p>
  
  <p>An acceptable alternative would be to supply each definition on the command line, like gcc's -D switch. Explicitely #including the settings file in each compilation unit is not an option (otherwise I would not have resorted to the gcc-specific -imacros approach).</p>