Guys
Guys

Reputation: 352

Can I link static library only with the .a file and without .xcodeproj one?

I've created a cocoa static library and want to link it to my other app.
Can I link it without including the .xcodeproj file ? (meaning - via the .a file only..)

I don't the sources will be available to whoever links against it (only public headers).

Thanks,
Guy.

Upvotes: 0

Views: 152

Answers (1)

Guys
Guys

Reputation: 352

We can link a static library without the .xcodeproj file.

Let's say we have libSDK.a file + public headers in our local "sdk/lib" and "sdk/include" folders (respectively) :

1. Drag the libSDK.a and headers files to our xcode project (preferrably in a dedicated group).
2. Double click on the target, select "Build" tab.
--- 2.1. Update the value in "Header Search Paths" setting to the "sdk/include" folder.
--- 2.2. Update the value in "Library Search Paths" setting to the "sdk/lib".
--- 2.3. Update the value in "Other Linker Flags" setting to "-ObjC -lSDK".
3. Build your project.

Now you're set to go.

Upvotes: 1

Related Questions