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.
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.
Summarizing, I would like to define a file .config with macro definitions:
CONFIG_MACRO_A=y
CONFIG_MACRO_B=y
# CONFIG_MACRO_C is not set
CONFIG_MACRO_C=y
And employ each line as a preprocessor macro in compilation time.
Thank you so much for the help.
config_file
. Check stackoverflow.com/questions/38419876/… and stackoverflow.com/questions/647892/… – usr1234567