Save 37% off PRO during our Black Friday Sale! »

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.

D15666558763fe2deffd703eeff36761?s=128

Ali Rantakari

January 22, 2013
Tweet

Transcript

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

    22, 2013
  2. Build Settings GUI

  3. [.xcconfig alloc]

  4. GUI vs Text GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited)

  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