Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Xcode Configuration Files

Xcode Configuration Files

What Xcode configuration (.xcconfig) files are, and why they might be useful to you.

Presented at the HelsinkiOS/CocoaHeads meetup on January 22, 2013.


Ali Rantakari

January 22, 2013

More Decks by Ali Rantakari

Other Decks in Programming


  1. Xcode configuration files Ali Rantakari HelsinkiOS / CocoaHeads • January

    22, 2013
  2. Build Settings GUI

  3. [.xcconfig alloc]


  5. Unique pros Human readable names Comments Custom organization Better at

    avoiding repetition Discoverability
  6. Comments // I am disabling -Wunused-variable because goddamnit, I might

    // need those variables later! Who knows, right! // WARNING_CFLAGS = -Wall -Wno-unused-variable
  7. DRY to the max *_Common *_Debug *_Release #include #include

  8. DRY to the max LIBFOO_ROOT = $(SRCROOT)/MyApp/libfoo HEADER_SEARCH_PATHS = "$(LIBFOO_ROOT)/include"

    LIBRARY_SEARCH_PATHS = "$(LIBFOO_ROOT)/lib" (Yes, you can do this with the GUI as well, but this is nicer, no?)
  9. Inheritance WARNING_CFLAGS = -Wall Common.xcconfig #include "Common.xcconfig" WARNING_CFLAGS = $(inherited)

    -Wno-unused-variables Other.xcconfig (!!) does not do what you may think it does
  10. Inheritance WARNING_CFLAGS = $(inherited) App_Target_Debug.xcconfig inheritance project config target config

    Value of WARNING_CFLAGS in the project config
  11. If you must composite values… MY_COMMON_WARNING_CFLAGS = -Wall Common.xcconfig #include

    "Common.xcconfig" WARNING_CFLAGS = $(MY_COMMON_WARNING_CFLAGS) -Wno-unused-variables Other.xcconfig Set final composite value in “leaf” config file Use custom keys for intermediate values
  12. Resolved values = “first from the left”

  13. Demo