tags:

views:

268

answers:

1

I have created a static library in XCode that requires several dynamic libraries (e.g. libsqlite3.0.dylib). I can create an application that is dependent upon my static library using cross-project references in XCode, but it seems that I have to manually add all of the required dynamic libraries to each of my application projects to get them to link.

Is there any way to configure a static library project in XCode so that dependent applications will automatically link against whatever dynamic libraries it requires?

I tried adding the dynamic libraries to the list of Frameworks in my static library project, but this seemed to have no effect.

+1  A: 

Yes -- you will need to add the libraries to the applications. A static library -- a .a -- is just an archive of .o files with a minimal bit of internal symbol resolution. The full symbol resolution doesn't happen until you link it into an application (or framework).

(Are you using sqlite3 directly? If so, why not use Core Data? There are reasons, but not nearly as often as people thing...)

bbum
Thanks. I know the .a file doesn't include any information about what dynamic libraries it requires, but I was hoping that there might be something in the .xcodeproj that could communicate this information to a dependent .xcodeproj file that references it. This seems theoretically possible, but perhaps it's just wishful thinking.I'm using sqlite3 because some of my apps need to work on OS 2.2.1.
cduhn
(CD: Makes sense, though I wonder how many of the remaining 2.2.1 users are active app purchasers) None that I know of in Xcode to do this. You might be able to use an xcconfig file -- a build configuration file -- and then share that between projects. The documentation can help.
bbum