5

I'm trying to add architecture specific locations for libraries in my build settings for my project. However for some reason I don't see them in the menu.


How my menu looks:

My Menu


How the menu is supposed to look

What it's supposed to look like

(Not exactly the same, but you can see how in this image they were able to select architecture specific options for the configuration setting. I'm only able to select OS specific things, not architecture)

See this page for a reference of how it should be working.

Nathan F.
  • 3,250
  • 3
  • 35
  • 69

1 Answers1

1

I had to find this out through experimentation and trial and error. I was unable to find any documentation out there for this afaik; if there is, I would be happy to see it.

You'll have to manually edit your project.pbxproj file. Find the setting you want to change (making sure it belongs to the correct target and configuration), and change it from

LIBRARY_SEARCH_PATHS = (
    /library/search/path/1,
    /library/search/path/2,
    /library/search/path/3,
);

to

"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*][arch=x86_64]" = (
    /library/search/path/1,
    /library/search/path/2,
    /library/search/path/3,
);

A few things to note:

  • When you add an option, make sure you add quotation marks, otherwise Xcode will not be able to parse the project.pbxproj file.
  • If you need to add more than one specific option, add another square-bracket delimited item like so [arch=x86_64].

The full list of sdks (as of this writing) comprise

iphonesimulator 
iphoneos 
watchos 
watchsimulator 
appletvos 
appletvsimulator 
macosx

Edit: Please also note that the build system distinguishes between iphoneos (iOS device) and iphonesimulator, so if a build isn't working, double check your [sdk=...] settings!

casvaart
  • 555
  • 1
  • 5
  • 14
  • 1
    I noticed that when i tried building using `Generic iOS Device`, and using this for my header search paths, it would not find my headers. If you want to be able to build using "Generic iOS Device", make sure you remove the `[sdk=...]` portion, it works just fine with only the `[arch=...]` portion. – Nathan F. Oct 22 '19 at 14:28
  • 1
    Ahh yes. I added the [sdk=iphonesimulator*] option to disambiguate it from building for macOS, as I've been working on a project that requires building for iOS device, iOS simulator, and macOS. – casvaart Oct 22 '19 at 14:32