On 20 Oct 2014, at 6:52 PM, Vul Hunt <[email protected]> wrote:
>
> G'Day Everybody,
>
> Can we use values of GCC_PREPROCESSOR_DEFINITIONS inside our custom *.plist
> files? Is there any way to treat custom plist same as App-Info.plist?
>
> I have tried all the build rules created custom build rules but could not
> find a way to get xcode to compile custom plist and replace
> GCC_PREPROCESSOR_DEFINITIONS to actual value.
>
> The way I do it now is to run a bash script which finds and replaces
> configuration from xcconfig, to my custom plist files.
You might or might not be confused on this point*: Property lists (.plist) are
a universal format for structured data in Cocoa. Think of it like JSON; the
original plist format was similar, though limited.
Info.plist is just a special case. It characterizes a package “file,” such as
an application, to the operating system — things like icon names, file types,
entry points, and launch behavior. But so long as you include what the OS
requires, you can put anything you like in an Info.plist for your own use.
As to your literal question: There is an Info.plist Preprocessor Definitions
build setting. Define MY_GCC_SETTINGS as $(GCC_PREPROCESSOR_DEFINITIONS) [the
build system will expand it], and use $(MY_GCC_SETTINGS) as the value of a
<string> in your Info.plist precursor. [The Info.plist processor will expand
that.] **
That's the simplest way, but it does force you to use Info.plist. If you want
to edit another plist, add a Run Script build phase and use PlistBuddy
(x-man-page://8/PlistBuddy) to make your changes. GCC_PREPROCESSOR_DEFINITIONS
will (I hope) be an environment variable.***
— F
* (I’m being cautious, no condescension intended. Off the top of my head as of
the last time I looked, not tested. Apologies for Aspy garrulity.)
** (The my_target-Info.plist is not literally copied into the bundle; the build
system preprocesses it for symbol expansions and mandatory computed entries.
Setting “Preprocess Info.plist File” passes the precursor through the C
preprocessor so you can use #preprocessor directives. Doing so commits you to
editing the file only in XML — the graphical editors don’t preserve comments or
preprocessor directives.)
*** (Bear in mind that while the build system tolerates/prefers
$(parenthesized) variables, you’re working with (usually) a shell interpreter
in script phases, and must use ${braces}.)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com
This email sent to [email protected]