In our C/C++ Project we use a configuration header (~1000 lines) that is full of #ifdef's and #defines
#if (defined(HW_1) || defined(SOME_TECHNOLOGY_SUPPORTED)) && defined(OTHER_TECHNOLOGY_SUPPORTED)
#define SOME_FEATURE_AVAILABLE
#endif
In our build configuration we predefine some defines that are passed to the compiler. This results in different defines (like SOME_FEATURE_AVEILABLE) in our configuration header.
Since our configuration header is quite big, there is also a bit of a mess.
Are there any alternatives for this #define
hell?
Or are there any tools that help to see in what case which defines are set.
We are developing embedded firmware so we can't replace conditional compiling by runtime if's.
autoconf
andautotools
.... – Whelancmake
, especially theconfigure_file
command. – Linincmake
. It has a usefull command to manage defines: https://mcmap.net/q/336140/-cmake-how-to-pass-preprocessor-macros – Oraorabel