Define preprocessor macros in a .config file
<p>I'm coding in C using CMake and I would like to define sobre preprocessor macros in a separate file. The purpose of this is to have a main configuration file for my apps.</p>

<p>I was tinking in doing something similar to the kernel .config files, but I didn't find how to pass a file with definitions to the compiler. I know the option -D of gcc to define a single macro, but it does not accept files as imput. I also know the ADD_DEFINITIONS utility of CMake but the usage but it is also expected to be used with a certain amount of macros, not a file.</p>

<p>Summarizing, I would like to define a file .config with macro definitions:</p>

<pre><code>CONFIG_MACRO_A=y
CONFIG_MACRO_B=y
# CONFIG_MACRO_C is not set
CONFIG_MACRO_C=y
</code></pre>

<p>And employ each line as a preprocessor macro in compilation time.</p>

<p>Thank you so much for the help.</p>