• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: testing build setting value in prefix file at compile time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: testing build setting value in prefix file at compile time


  • Subject: Re: testing build setting value in prefix file at compile time
  • From: Steve Caine <email@hidden>
  • Date: Thu, 17 May 2007 23:15:15 -0400

Thank you, James. That was the answer I was searching for.

I just add

	GCC_PREPROCESSOR_DEFINITIONS = $(inherited) _DEBUG

to the xcconfig file that all my projects inherit in their Debug configurations, and now the top of each project's prefix file becomes


// config_flags.h

// IS THIS DEBUG OR RELEASE BUILD?
#ifdef __MWERKS__
# if __ide_target("Debug")
# define _DEBUG
# endif
#elif __GNUC__
// build setting GCC_PREPROCESSOR_DEFINITIONS has defined _DEBUG (in "project.debug.xcconfig")
#elif defined(_MS_VER)
// Visual Studio #define's _DEBUG for us
#endif



Thanks again.

Steve


At 05:23 PM -0700 05/17/07, James Bucanek wrote:
Steve Caine wrote on Thursday, May 17, 2007:
How can I set compile-time flags in a header file so they will be
"on" in debug builds but "off" in release builds?

See the Xcode build settings "Preprocessor Macros" and "Preprocessor Macro Not Used in Precompiled Header".


In your Debug build, define a processor macro. In my projects, I define "IS_DEVELOPMENT=1".
In your Release build, either leave the macro undefined or define it as "IS_DEVELOPMENT=0".


In you code, you can then

    #if IS_DEVELOPMENT
        ...
    #endif


James Bucanek ____________________________________________________________________ Author of Beginning Xcode ISBN: 047175479X <http://www.beginningxcode.com/>

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: testing build setting value in prefix file at compile time (From: James Bucanek <email@hidden>)

  • Prev by Date: Re: testing build setting value in prefix file at compile time
  • Next by Date: NSTask collecting pipes
  • Previous by thread: Re: testing build setting value in prefix file at compile time
  • Next by thread: NSTask collecting pipes
  • Index(es):
    • Date
    • Thread