I have two Xcode projects: Super
and Sub
. Super
has a custom configuration: Enterprise
. Sub
only has the default configurations: Debug
and Release
. Super
has a target dependency on Sub
. When I build Super
with the Enterprise
configuration, Sub
builds with its default configuration: Release
. This yields the following hierarchy:
Build
|-Products
|-Enterprise-iphoneos
|-Super.app
|-Release-iphoneos
|-libSub.a
|-Sub
|-Sub.h
Clang fails to build because libSub.a
and Sub/Sub.h
is normally in the same directory as Super.app
, but instead is in a different directory because Sub
built with the Release
configuration instead of Enterprise
. I control both projects, so I could easily add an Enterprise
configuration to Sub
, but I feel like there must be a magical incantation of Xcode Build Settings to make this work.
I have solved exactly the same problem by using Xcode Configuration Files in my parent project - typically your application.
These are the steps I took:
Create a Base Configuration file in Xcode via New > Other > Configuration File.
Write your base xcconfig
file, mine looks a bit like this:
/// Configure Search Paths
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/include" "$(BUILT_PRODUCTS_DIR)/usr/local/include"
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../Externals/Libraries/GoogleAnalytics"
/// Linker flags
OTHER_LDFLAGS=-ObjC -all_load
The thing to note here, is that $(BUILT_PRODUCTS_DIR)
is the concatenation of:
$(BUILD_DIR)/$(CONFIGURATION)-$(PLATFORM_NAME)
Write a specialised configuration for a custom configuration. I created an Ad Hoc configuration which duplicated Release, therefore my search paths now look like this:
#include "BaseConfig.xcconfig"
/// Ad Hoc search paths
HEADER_SEARCH_PATHS = "$(BUILD_DIR)/Release-$(PLATFORM_NAME)/include" "$(BUILD_DIR)/Release-$(PLATFORM_NAME)/usr/local/include"
LIBRARY_SEARCH_PATHS = "$(BUILD_DIR)/Release-$(PLATFORM_NAME)" "$(SRCROOT)/../Externals/Sources/GoogleAnalytics"
Then in your application's project's Info tab select your configurations, to use the Base Configuration for Debug and Release, and then the special one for your custom configuration.