I have a project I am splitting into two targets. The original single-target project uses a number of define commands, however I need these values to now be different depen
One approach would be like this:
#if defined(MON_TARGET_A)
#define MON_TARGET_NAME "App A"
#elif defined(MON_TARGET_B)
#define MON_TARGET_NAME "App B"
#else
#error "which target are you building?"
#endif
Then add MON_TARGET_A
or MON_TARGET_B
to your target's preprocessor settings.
Usually, you'll use GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS
and not GCC_PREPROCESSOR_DEFINITIONS
because the latter can prevent sharing of PCH headers.
To add this, go to:
then drop GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS
into the search field and set its value to something like: MON_TARGET_A $(inherited)
You can add additional preprocessor macros in your target settings (Preprocessing->Preprocessor Macros) and use #ifdef.
This is the most flexible approach.