How to build static libraries with XCode


If you’ve created a static library project with XCode, but can’t figure-out
how to get your libraries named differently for both debug and release builds, then here is what you need to do. Took me ages to figure out, I hope it saves you some time!

  • right-click on the “target” entry in your main project view, and select
    "set info" from the pop-up menu.
    … set the product name to be e.g. “thing” for release and "thingdebug"
    for debug.

  • select the normal project settings, and for “All Configurations”:

    • there are three sub-folders you need to set to “bin” rather than the
      defaults. Jules does something similar in his Juce project for Mac.

Now, when you build, your target libraries for release and debug builds appear as libthing.a and libthingdebug.a respectively in the “bin” folder under your project area.

Hoping this helps somebody!



I suppose it would be too much to ask if the XCode developers could take a look at Visual Studio to see how it should be done… :slight_smile:

I can’t think of anything in XCode that isn’t easier to do in Visual Studio… :frowning:

Oh well…!