For example, if I need Gtk+ include paths.
How to use pkg-config gtk+-2.0 --cflags
in Xcode project settings?
One option, but it's not very portable to other developers on the project -- you can just run pkg-config gtk+-2.0 --cflags
in your Terminal and paste it into Build Settings -> Other C Flags
. I'd be interested to hear how others deal with this in a more portable way though. Ideally, it would be nice to have pkg-config run at compile-time to make building more system-independent.
In Build Phases, add a Run Script
#!/bin/bash
OTHER_CPLUSPLUSFLAGS="$(pkg-config gtk+-2.0 --cflags)"
echo -e "OTHER_CPLUSPLUSFLAGS = \$(inherited) ${OTHER_CPLUSPLUSFLAGS}" > MyApp.xcconfig
In Info in your project, set MyApp.xcconfig as your target configuration file
One drawback is that until you build the aggregate target directly or indirectly at least once, the autocomplete will not work properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With