It’s always been fairly painful to set up a target that uses a library built by another target (either in the same project or another one). The procedure for setting this up seems to have changed in Xcode 4, but I can’t find anything in the docs that describes it. And I’m having a hard time with a project that seems to build for other people but won’t for me, because of dependent library problems.
As an example, say I have - A.xcodeproj, with a target TargetA that builds libA.dylib (or libA.a). - B.xcodeproj, with a target TargetB that links against libA.
In Xcode 3 I would have dragged A.xcodeproj into B’s source list; opened the editor for target B; clicked the + in the list of target dependencies, and chosen TargetA from the pop-up. This would set up TargetB to link in libA (including finding the right debug/release variant based on the current configuration), add the right library search paths, and force TargetA to rebuild before building TargetB.
How do I set this up in Xcode 4?
I ask because I’ve spent all day struggling with a workspace checked out from github [1], which builds fine for other people but generated all sorts of build errors for me. After painfully fixing the errors (all of which stemmed from library or framework search paths not being set up), I finally figured out that the difference between my Xcode and other people’s is the global preference for where build files go. (Prefs > Locations > Derived Data > Advanced.) If it’s set to the default, the derived-data location, the project builds; but mine is set to “locations specified by targets” (and always has been, ever since the ProjectBuilder days.)
Surely there has to be a way to set up the library dependencies that doesn’t break when someone changes a pref. :/
—Jens
|