• 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: iPhone target-specific headers for Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iPhone target-specific headers for Xcode


  • Subject: Re: iPhone target-specific headers for Xcode
  • From: Fritz Anderson <email@hidden>
  • Date: Wed, 6 May 2009 09:36:08 -0500

On 6 May 2009, at 8:58 AM, Sam Krishna wrote:

How do I create a target-specific header file that's included automatically when I switch build targets back and forth between Lite and Pro for an iPhone application project?


I assume the target-specific header files all have the same name, and you want #import <header.h> to refer to a file in one place for one target, and another place for another?

There may be ways to do this, by fooling with the header search paths in the separate targets (maybe putting the specifics in directories that are sisters to the directory containing the project file). I haven't tried this, and I don't know how it interacts with the project root directory (Project Info / General) and SCM.

Instead, why not have header.h wrap the two different files, with #ifdefs choosing between them?

#if defined(TARGET_1)
	#import <header-target-1.h>
#elif defined(TARGET_2)
	#import <header-target-2.h>
#else
	#error Must define a TARGET macro!
#end

You can set the preprocessor macros in the build settings of the several targets. See "Preprocessor Macros Not Used In Precompiled Headers." (Grammar nit: Title-case does _not_ mean capitalizing every word. "Not" and "In" should be all-lower.)

	— F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- <http://x3u.manoverboard.org/ >


_______________________________________________
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


  • Follow-Ups:
    • Re: iPhone target-specific headers for Xcode
      • From: Clark Cox <email@hidden>
References: 
 >iPhone target-specific headers for Xcode (From: Sam Krishna <email@hidden>)

  • Prev by Date: iPhone target-specific headers for Xcode
  • Next by Date: Re: iPhone target-specific headers for Xcode
  • Previous by thread: iPhone target-specific headers for Xcode
  • Next by thread: Re: iPhone target-specific headers for Xcode
  • Index(es):
    • Date
    • Thread