Re: Equivalent to xcconfig conditionals available?
Re: Equivalent to xcconfig conditionals available?
- Subject: Re: Equivalent to xcconfig conditionals available?
- From: "Mattias Arrelid" <email@hidden>
- Date: Wed, 25 Jun 2008 14:20:44 +0200
On Wed, Jun 18, 2008 at 5:16 AM, Ken Thomases <email@hidden> wrote:
> On Jun 17, 2008, at 7:26 AM, Mattias Arrelid wrote:
>
>> We have some xcconfig files that we use for several of our build
>> targets. All these config files includes a master xcconfig file with
>> some default values. Now, it would be nice if this master file, after
>> all declarations, could have a conditional import depending on some
>> variable that we are able to set. Let me show you how I want it to
>> look (in pseudo xcconfig language):
>>
>> SOME_SETTING_1 = SOME_VALUE_1;
>> SOME_SETTING_2 = SOME_VALUE_2;
>> ...
>> ...
>> SOME_SETTING_N-1 = SOME_VALUE_N-1;
>> SOME_SETTING_N = SOME_VALUE_N;
>>
>> #ifdef SOMETHING
>> #include "config_for_something.h"
>> #else
>> #include "another_config.h"
>> #endif
>>
>> Can I achieve this somehow? The Xcode User Guide doesn't reveal too
>> much on this, and neither does searching Google and this archive. I
>> know we could split each target into two targets, but that really
>> isn't feasible. If one cannot have conditionals, I guess there is no
>> syntax for checking if a config file is present before inclusion
>> either?
>
> Rather than "split[ting] each target into two targets", how about using one
> target with two build configurations?
>
> Rather than having a master xcconfig that conditionally includes a specific
> sub-configuration xcconfig, I believe it's more typical for there to be
> specific xcconfig files for each case, which include one generic xcconfig to
> establish a baseline. So, you'd have:
>
> config_for_something.xcconfig:
> #include "generic.xcconfig"
> SETTING_SPECIFIC_TO_SOMETHING = SOME_VALUE;
>
> and:
>
> another_config.xcconfig:
> #include "generic.xcconfig"
> SETTING_SPECIFIC_TO_ANOTHER = SOME_DIFFERENT_VALUE;
>
> Then, one of the build configurations for the target will be based on
> config_for_something.xcconfig, while another will be based on
> another_config.xcconfig.
>
> Google uses this sort of approach in their Mac toolbox
> <http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/XcodeConfig/>
That's how we do it right now; generic.xcconfig is included in both
debug.xcconfig and release.xcconfig. The project setting uses these
two files for the "Debug" and "Release" configuration respectively.
Then each target has a separate configuration file, like
target.xcconfig. Doing stuff that way is kind of neat:
all.xcconfig > {configuration}.xcconfig > {target}.xcconfig
Now, this works perfectly regarding to what we're doing so far;
building libraries.
The problem appears when we go to the next Xcode project (let's call
this the top level project, it produces an application bundle). Let's
pose that a target of this project will use one of the above mentioned
libraries. To do this, we add that library's Xcode project to our
Xcode project. In addition to this, we add the library target of that
Xcode project as a dependency of our target. Now, how can we, at this
level, specify a build setting that should be used in this target
_and_ all targets that we're depending on? What we really want here
is:
all.xcconfig > {configuration}.xcconfig > {target}.xcconfig >
{current_project.xcconfig}
So, if conditional includes were possible, we would like to have had a
{top_level}.xcconfig file included at the bottom of each
{target}.xcconfig that included special setting regarding to the top
level project we are building (and causing those libraries to be
built).
I really cannot se how this would be possible? Am I still missing something?
Best
Mattias
_______________________________________________
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