2

What is the preferred way to share code across different Xcode projects?

I'm not specifically talking about code I've written, but more so open source code found on GitHub and friends.

In most scenarios the cloned repo may only consist of a handful of files, and in some cases just a single .h and .m so using static libraries seems a little overkill. Also, I'd like to stay away from manually adding anything to these repos (like configuring a static library target) since they are likely to be updated regularly by their respective owners; remember these are clones, not forks.

I've tried playing around with Xcode's workspaces but it just ends up complaining it can't find certain header files regardless of what I put in header/user header search paths.

1 Answers1

2

Regarding shared workspaces, this post should help with search paths. Otherwise, this is a good weblog post for using GitHub with Xcode 4.

Community
  • 1
  • 1
petert
  • 6,672
  • 3
  • 38
  • 46
  • 1
    I have seen the first post you reference, and tried the first answer but alas it did not work. The issue seems to lie with the Xcode environment variables reporting the wrong location. For instance `$(TARGET_BUILD_DIR)` translates to `/build/Debug/` but when using workspaces an extra folder is inserted into that path `/build/products/Debug` which Xcode seems to ignore or can't handle. The second answer seems a little more appropriate, but will this work when I just want to use the source directly rather than create a static lib? (*I'm not looking to use Xcode with GitHub directly*) –  Jul 08 '11 at 10:39
  • I just went through the steps in this post with a new shared workspace project I'm working on - http://stackoverflow.com/questions/5534235/how-do-you-get-implicit-dependencies-to-work-with-workspaces-in-xcode-4. Saw the same issues with header errors until I followed the exact steps in the accepted answer; not ideal, duping the bug report. – petert Jul 08 '11 at 13:00
  • I have also seen and tried that solution, but really don't like it. For me it defeats the point of using a workspace, as if I have to copy across the headers, I may as well copy across the whole source tree. –  Jul 08 '11 at 13:25