1

So here's the scoop:

I have an xcode project that builds a standard library. This standard library produces a ".a" file, along with a few header files that need to be visible to whatever client is using said lib.

The standard lib builds to a set directory:

/builds/foo/bar/build/

Which looks like this after I build the library:

/builds/foo/bar/build/
    lib.a
    headers/
        head1.h
        head2.h
        head3.h

I have a client application that needs to consume this library. It's required that I rebuild the standard lib with every build of the client app, so I set it up as follows:

I created a client application, added the standard lib .xcodeproj file to it, and hooked it up as a direct dependency. I linked it appropriately in the "Link Binary with Library" section. Then, following standard suit, I set it up the client app to search for the header files at the following location:

/builds/foo/bar/build/headers/

And this works... sort of. If I delete the directory listed above and try to rebuild, it will fail because it cannot find the header files.

"Well, Duh! You deleted the directory that contains the header files!".

True, but the way the client build is setup is such that the static library is compiled and placed within /builds/foo/bar/build directory (including header files), before the client application builds. It SHOULD be finding these header files. They exist before the client is compiled, and the 'Header Search Path' is set correctly.

As I said before, if I delete the directory that contains the lib and header files, and try a clean build of the client application, it fails. Although the build fails, the /builds/foo/bar/build directory gets created and populated, meaning all subsequent builds and cleans succeed.

Any idea how to fix this issue?

Jeff
  • 623
  • 3
  • 8
  • 22
  • What exactly is the failure message? – lawicko Mar 02 '12 at 23:04
  • Lexical or Preprocessor Issue: "head1.h" file not found. So obviously, this phase of checking is happening before the direct dependencies are compiled... else, it wouldn't be an issue. – Jeff Mar 02 '12 at 23:33
  • Nah, the direct dependencies **must** be ready before any check happens, check if you don't make mistake [here](http://stackoverflow.com/questions/3429031/header-search-paths-vs-user-header-search-paths-in-xcode). – lawicko Mar 03 '12 at 09:43
  • No mistake was made setting the header search paths - thanks anyway, though. – Jeff Mar 05 '12 at 22:11

1 Answers1

0

Usually Xcode 4 handles the building of dependent projects correctly; but I have found circumstances where it does not. You could try editing the scheme and making the static library dependency explicit.

FluffulousChimp
  • 9,157
  • 3
  • 35
  • 42