Reputation: 4843
Hopefully this is a simple question to answer - I think I'm being a n00b here.
I have, for the first time, created an XCode project with two targets. But I now want to add some code to differentiate between my two targets.
#ifdef MyTargetOne
x = 1;
#ifdef MyTargetTwo
x = 2;
I have two targets, but where do I declare "MyTarget1" and "MyTarget2"??
THANKS GUYS!
Upvotes: 8
Views: 7000
Reputation: 213059
For each target you need a target-specific define - you can use the Preprocessor Macros
setting for this ([GCC_PREPROCESSOR_DEFINITIONS, -D]
) - add MyTargetOne=1
in the first target and MyTargetTwo=1
in the second.
Upvotes: 12