views:

1902

answers:

2

Update: It appears that a recent XCode update may have changed this macro, please see this Question & Answer for more information: http://stackoverflow.com/questions/2292694/obtaining-older-sdkroot-behavior-in-xcode


Situation: I'm using libxml2 on an iPhone project and I've added it as relative to the SDK version. However, in order to actually use it in the project, it needs to be added to the Header Search Paths in the Project Settings.

I would like this to be entirely SDK version agnostic, so the header search path should also be relative to SDK version, however there's no apparent way to do expand a variable representing the SDK folder.

For example, here's the actual literal path:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/libxml2

I'd like to be able to express

$MAGICAL_BASE_SDK_VARIABLE/usr/include/libxml2

Is this something that can be accomplished using XCode?

+4  A: 

Figures that I'd figure this out an hour after fighting it and only 3 minutes after posting it.

The macro to use in this situation is ${SDKROOT}. Therefore, all one needs to do is add a Header Search Path like: "${SDKROOT}/usr/include/libxml2", and it will resolve appropriately.

Note the code isn't totally working yet, but it's clear that it's at least picking up the location of the header files.

Justin Searls
A: 

I'm confused, SDKROOT is expanding to "iphoneos2.2.1" for me, which obviously doesn't work. Any idea? Multiple sources confirm that this should work so I'm a little confused.

Brian King
Looks like the behavior changed in the latest XCode update. I asked a new question since it seems to be different.http://stackoverflow.com/questions/2292694/obtaining-older-sdkroot-behavior-in-xcode
Brian King