Xcode workspaces with sub-projects and project dependencies triggering builds

前端 未结 6 473
轻奢々
轻奢々 2021-01-31 08:18

I wish there was better documentation for this for Xcode 5 but I couldn\'t find anything decent describing best practices for working with workspaces, so..

In a workspac

6条回答
  •  感情败类
    2021-01-31 08:40

    This is derived from Tomte's answer. His approach was causing me a Dependency Analysis Error. This is a more straight forward approach and explains why Tomte's answer works:

    1. Click on the sub-project and drag it into the project that needs to target the sub-project.
    2. The options alert should now be displayed. Make sure Copy items if needed is not selected. Make sure Create groups is selected. Make sure none of the project's targets are selected. Press the Finish button.
    3. Click on the project that you just added the sub-project reference to.
    4. Click on the target that you want to have a dependency on the sub-project.
    5. Click the Target Dependecies + button.
    6. Notice the sub-project's product is listed as an option. Select it.

    Note that when using Tomte's approach, when the project is added to Link Binary With Libraries, a project reference is created. This project reference can be found in the Frameworks group of the project.

    I'm conflicted as to whether this is a good approach or not. The scheme approach is not much better, in my opinion. I'm actually wondering why workspace project's don't have this relationship by default.

    At the very least, this should clear up the magic in Tomte's solution.

提交回复
热议问题