xcode project-/target-settings-syntax for linker flag force_load on iPhone

I just tried this. I've compiled a static armv6, armv7, and i386 fat binary of PCRE for use in my iPhone project. My project normally just has my library added to the project and that links fine. So I unchecked the target membership box for libpcre.a and rebuilt. As expected, I get a bunch of missing symbol linker errors for the pcre symbols. Then I opened the target settings window and edited the "Other Linker Flags" section. I added:

-force_load lib/pcre/libpcre.a

The lib directory is in the same directory as my project.xcodeproj file.

It linked fine so I know the force_load command worked (and I can see it added to the build flags when xcode builds the file).

Hope that helps.


I also tried adding a system library to the "Other Linker Flags" line like so:

-force_load src/pcre/libpcre.a -force_load ${SDKROOT}/usr/lib/libz.dylib

That worked too.