Predefined Xcode / GCC macro for target name?

I was wondering if there is an Xcode or GCC preprocessor character for the target application name.

For example, if I create an application called "MonkeyChicken", is there a preprocessor character to

printf( __TARGET_NAME__ )

outputs:

MonkeyChicken
+3
source share
1 answer

I don’t believe that there is a built-in (gcc does not know what you build when compiling the file), but you can always create it using the GCC_PREPROCESSOR_DEFINITIONSxcconfig file (you are using xcconfig , right?) Something like this should work, how do you indicate above:

GCC_PREPROCESSOR_DEFINITIONS = __TARGET_NAME__=\"$(PRODUCT_NAME)\"
+7
source

Source: https://habr.com/ru/post/1717798/


All Articles