Search code examples
xcode8build-settingslinker-flags

Difference between Build Phases -> Link Binary with Libraries or Build Settings -> Linker Flags


What's the difference between Build Phases -> Link Binary with Libraries or Build Settings -> Linker Flags?

The former does not seem to allow you to specify between Debug vs Release, and the frameworks specified within it also don't seem to match up with the latter.

Note: I have checked existing posts on SO, haven't found one that answers this accurately.


Solution

  • Xcode translates libraries in Build Phases – Link Binary With Libraries into linker flags: -lsome or -framework Some.

    Build Phases is a somewhat abstract view on build process. You have this linker step listed here, but it is one-way – it doesn't reveal what is already there for linker in Linker Flags, it only adds new flags to linker.

    "Optional" libraries translate to weak linking: -weak-lsome and -weak_framework Some