Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create an #ifdef command to differentiate between my two targets in XCode?

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!

like image 246
theDuncs Avatar asked Nov 25 '11 13:11

theDuncs


1 Answers

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.

like image 82
Paul R Avatar answered Nov 09 '22 07:11

Paul R