Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: Setting GCC_PREPROCESSOR_DEFINITIONS for different build configurations?

I want to set GCC_PREPROCESSOR_DEFINITIONS for each of my four build configurations (Debug, Release, Ad Hoc, and Distribution.) I'd like to have a different setting for each.

The screen I'm looking at is the Target Info window's "Build" tab. When I set the Configuration pop-up to "Debug" I can see my GCC_PREPROCESSOR_DEFINITIONS setting there. When I switch to "Release," or any of the other configurations, it's no longer visible. Yet when I try to add it to those configurations, it says GCC_PREPROCESSOR_DEFINITIONS already exists, and that I can't add it again.

As I said, I want to have a different setting for my various builds. How can I accomplish this?

Thanks very much.

like image 281
Greg Maletic Avatar asked Oct 08 '09 20:10

Greg Maletic


People also ask

How do I change the build configuration in Xcode?

You can change it easily. On the top menu click on your project name. In my case, it's BuildVersion (the name of the project). On the left panel select Run and change Build Configuration to Release.

What is Dstroot?

DSTROOT (Installation Build Products Location) Identifies the directory into which the product is placed. In this directory, the product is laid out exactly as it would be installed in a user's filesystem.

What is preprocessor macros in Xcode?

Preprocessor Macros are directives executed by the compiler, so they're not part of Objective C. We've used them many times before with the #import statement. But to stay with our Lite and Pro example: you can use a Preprocessor if/then statement to check which version is being compiled.


1 Answers

OTHER_CFLAGS if I understood the question right. And pass your defines like -DDEBUG or something.

And yes, if you need to assign a value to a macro, you could do something like this - '-DSOME_MESSAGE=@"Hello, World!"'. Note ' symbols around - they are required. SOME_MESSAGE macro will be defined with @"Hello, World!" value.

like image 107
jazzcat Avatar answered Sep 28 '22 05:09

jazzcat