Question: I am trying to clean up some of my projects, and one of the things that are puzzling me is how to deal with header files in static libraries that I have added as "project dependencies" (by adding the project file itself). The basic structure is like this:

```

MyProject.xcodeproj
  Contrib
    thirdPartyLibrary.xcodeproj
  Classes
    MyClass1.h
    MyClass1.m
    ...

```

Now, the dependencies are all set up and built correctly, but how can I specify the public headers for "thirdPartyLibrary.xcodeproj" so that they are on the search path when building MyProject.xcodeproj. Right now, I have hard-coded the include directory in the thirdPartyLibrary.xcodeproj, but obviously this is clumsy and non-portable. I assume that, since the headers are public and already built to some temporary location in ~/Library (where the .a file goes as well), there is a neat way to reference this directory. Only.. how? An hour of Googling turned up blank, so any help is greatly appreciated!

Answer: 
If I understand correctly, I believe you want to add a path containing $(BUILT\_PRODUCTS\_DIR) to the HEADER\_SEARCH\_PATHS in your projects build settings.

As an example, I took an existing iOS project which contains a static library, which is included just in the way you describe, and set the libraries header files to public. I also noted that the PUBLIC\_HEADERS\_FOLDER\_PATH for this project was set to "/usr/local/include" and these files are copied to $(BUILT\_PRODUCTS\_DIR)/usr/local/include when the parent project builds the dependent project. So, the solution was to add $(BUILT\_PRODUCTS\_DIR)/usr/local/include to HEADER\_SEARCH\_PATHS in my project's build settings.

```
HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include

```

Your situation may be slightly different but the exact path your looking for can probably be found in [Xcode's build settings](http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/0-Introduction/introduction.html). Also you may find it helpful to add a Run Script build phase to your target and note the values of various settings at build time with something like:

```
echo "BUILT_PRODUCTS_DIR " $BUILT_PRODUCTS_DIR
echo "HEADER_SEARCH_PATHS " $HEADER_SEARCH_PATHS
echo "PUBLIC_HEADERS_FOLDER_PATH " $PUBLIC_HEADERS_FOLDER_PATH
.
.
.
etc.

```
The way we do it is to go into build target settings for the main project and add:

```
User Header Search Path = "Contrib"

```

and check that it searches recursively. We don't see performance problems with searching recursively even with many (10-15 in some projects) dependencies.