Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: How to add the built product from one project to another in the same workspace?

Say I have 2 projects in an Xcode 4 workspace. Project A is the final product which requires the utility app built from project B. The goal is to have the build process of A automatically build project B if necessary, then copy the built app into the resource folder of product A's app bundle.

Xcode 4's documentation is really lacking in this regard. I tried adding the built B.app into project A with Add Files to "project A"... command. It does copy the app bundle but it doesn't check for a dependency. That is, it does not automatically build project B when it's updated.

Any pointer to find the right documentation is also much appreciated.

Edited: I am looking to accomplish the first 2 benefits mentioned in this doc, that are:

  • One project can use the products of another project while building.

  • If one project depends on the products of another in the same workspace, Xcode can detect this and automatically build the projects in the correct sequence.

I know the plain old project way of adding a project to another one as a sub-project so I can set the target dependencies. But from the wording of the workspace doc, there's seems to be an easier and automatic way. But I am not able to find the steps to do either of the two features.

like image 402
Stephen Chu Avatar asked Oct 31 '11 15:10

Stephen Chu


1 Answers

Add project B as "Target dependency" in project A's "Build phases" tab in the target screen. (The screen that you get when you click on the top level project node)

Update:
It seems that a project can only define the output of another project as dependency if the second project is a subproject of the first:

I can define the output of Project B as dependency of A in this constellation

If your Workspace has the following structure, defining dependencies is not possible: Output of B does not show up in the dependency editor of A in this constellation

like image 196
Thomas Zoechling Avatar answered Nov 15 '22 09:11

Thomas Zoechling