Search code examples
iphonexcodestatic-linking

How to link different precompiled libraries for different build profiles in XCode for iPhone?


My client is providing me with two precompiled libraries, blah-device.a and blah-simulator.a. How do I tell xcode to use blah-device.a in Device compilation mode and simulator in Simulator compilation mode?

My client gives me these instructions

  1. Open the Targets group (in the Groups & Files panel), right-click the project icon, then select Add > Existing Frameworks.
  2. In the Linked Libraries section, click the Add Libraries icon (+) icon, then click Add Other.
  3. Select either blah-device.a (for developing directly on the iPhone device) or blah-simulator.a (for developing on the iPhone Simulator), then click Add.

I already copied the header file in there, however these instructions don't make building easy with different profiles.

How do I get Xcode to link blah-device.a when building with the DEVICE profiles and blah-simulator.a when building with the SIMULATOR profiles?

Any help is greatly appreciated.


Solution

  • There is an easier way to do that. You can duplicate the "Library Search Paths" under one target and set a different architecture for each one. You can then set a different path for simulator and devices.