0

I have one static library for testing and one for release. The debugging static lib has calls that aren't available in the release version. In my code I use preprocessor macro to guard around calls that are available in the testing static lib.

How do I include both libs in the project and make one of them be linked during the linking process depending on the build I am doing?

NOTE: I don't have access to the code to the static library so I can't make any changes. All I have access to is the client code making use of the lib.

1
  • Consider using multiple "targets". Commented May 8, 2013 at 18:26

1 Answer 1

1

In the Target Build Settings, under Linking, Other Link Flags - you can include your debugging library in Debug, and the real one in Release (Deployment, etc). First remove it from the Link Binary With Libraries under Build Phases.

Sign up to request clarification or add additional context in comments.

6 Comments

Should the lib be specified in Build Phases as optional?
No - remove it completely - since you can only have one there not two. Its the same thing to the build system - libraries in the Build Phase just get added to the link phase. So doing this yourself works fine (I've done this before), but don't have the exact link syntax handy. Will be something like "-l $(XcodeMacroToProjectDirectory)/somefolder/libA.a"
Is it possible to have the linker not linked a specific library?
I'm totally confused. You said you have two libraries, one you want for Release, one for Debugging. If you don't link the library how will your app run??? The whole way this technique I laid out for you works, is that you can specify under the Linker Flags different values for each Build Configuration.
Sorry for the confusion. I have quite a few configurations, so I was thinking to do this in an opposite way - have Xcode link by default (in Build Phases) and only in debug configuration I have Xcode unlink the release library and link the debugging library. Probably doesn't work that way.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.