Xcode build settings

Xcode build locations may mislead developers hoping to fully control the output of the IDE. While we can use CONFIGURATION_BUILD_DIR for the xcodebuild tool during continuous integration, IDE generates files in different locations, and sometimes we want to control it too.

First, misleading part:

Per-configuration Build Products Path states "build/Debug-iphoneos", however it's not true - the output is controlled by the workspace settings (File -> Workspace Settings... -> Advanced):

However, using workspace settings is not flexible enough and may have some issues. In particular, we can't save these settings into the version control: it's per-user basis, and we do not usually want to save xcuserdata directory into the VCS.

It looks like the Xcode GUI for the Build Locations section is not always working properly, and it shows the build location for the legacy mode by default (Xcode prior version 4) where SYMROOT settings (Build Product Path) was used. However, the documentation for settings is correct:

Per-configuration Build Products Path


The base path where build products will be placed during a build for a given configuration. By default this is set to `$(BUILD_DIR)/$(CONFIGURATION)`.

Workspace settings does set up this BUILD_DIR and by modifying this particular setting, we can control the build products output. The same about intermediate build files:

Per-configuration Intermediate Build Files Path


The base path where intermediates will be placed during a build for a given configuration. By default this is set to `$(PROJECT_TEMP_DIR)/$(CONFIGURATION)`.

BUILD_DIR and PROJECT_TEMP_DIR do not have entries in the Build Settings page, but we can set those up with User-Defined Settings:

BUILD_DIR = $(SRCROOT)/Build/Products
PROJECT_TEMP_DIR = $(SRCROOT)/Build/Intermediates

Please note that you can set up any paths there, the example refers to the path relative to the project root with the names consistent with the default ones.


Popular posts from this blog

DIY: Business cards in LaTeX

Python vs JS vs PHP for embedded systems

Web application framework comparison by memory consumption