One approach would be 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 the target preprocessor settings.
Usually you use GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS and not GCC_PREPROCESSOR_DEFINITIONS , because the latter may prevent the sharing of PCH headers.
To add this, follow the link:
- Project Navigator β Project β Goal β Build Settings
then drop GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS in the search field and set its value something like this: MON_TARGET_A $(inherited)
source share