Xcode : Adding a project as a build dependency

XcodeXcodebuildBuild Dependencies

Xcode Problem Overview


Im playing around with the soundcloud api, in its instructions it says to

  • drag SoundCloudAPI.xcodeproj into your project
  • add it as a build dependency

I can drag the project in pretty easily, but how does one accomplish the next step?

Xcode Solutions


Solution 1 - Xcode

To add it as a dependency do the following:

  • Highlight the added project in your file explorer within xcode. In the directory browser window to the right it should show a file with a .a extension. There is a checkbox under the target column (target icon), check it.
  • Right-Click on your Target (under the targets item in the file explorer) and choose Get Info
  • On the general tab is a Direct Dependencies section. Hit the plus button
  • Choose the project and click Add Target

Solution 2 - Xcode

  1. Select your project in the navigator on left.
  2. Open up the drawer in the middle pane and select your target.
  3. Select Build Phases
  4. Target Dependencies is an option at that point.

Solution 3 - Xcode

Tough one for a newbie like me - here is a screenshot that describes it.
Xcode 10.2.1

enter image description here

Solution 4 - Xcode

Under TARGETS in your project, right-click on your project target (should be the same name as your project) and choose GET INFO, then on GENERAL tab you will see DIRECT DEPENDENCIES, simply click the [+] and select SoundCloudAPI.

Solution 5 - Xcode

Just close the Project you want to add , then drag and drop the file .

Solution 6 - Xcode

Xcode 10

  1. drag-n-drop a project into another project - is called cross-project references[About]
  2. add the added project as a build dependency - is called Explicit dependency[About]
//Xcode 10
Build Phases -> Target Dependencies -> + Add items 

//Xcode 11
Build Phases -> Dependencies -> + Add items 

In Choose items to add: dialog you will see only targets from your project and the sub-project

enter image description here

Solution 7 - Xcode

Today I faced with the same problem. As the result of the first run I got next error:

> Lexical or Preprocessor Issue: 'SDKProjectName*/*SDKProjectName.h' > file not found.

But before running, I, obviously, added my SDK into the demo project, just drag&drop .xcodeproj file into my test project's source tree. After that, I moved into Build Phases tab in setting of the main xcodeproj file (of the demo) and added my SDK as target dependency and embed framework into corresponding tabs.

But at the result, I got an error above!

So, the problem was into empty line on the Header Search Paths option. I just wrote "../**" as value for this key and project compiled successfully. So, after that, you can add #include <SDKName/SDKName.h> into any project, which includes this SDK.

ps. My test app was created into root SDK folder.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAran MulhollandView Question on Stackoverflow
Solution 1 - XcodetheChrisKentView Answer on Stackoverflow
Solution 2 - XcodetheprojectabotView Answer on Stackoverflow
Solution 3 - XcodechenopView Answer on Stackoverflow
Solution 4 - XcodeWrightsCSView Answer on Stackoverflow
Solution 5 - XcodeAlokView Answer on Stackoverflow
Solution 6 - XcodeyoAlex5View Answer on Stackoverflow
Solution 7 - XcodehamsternikView Answer on Stackoverflow