The configuration of the Xcode project is saved into the project file (*.xcodeproj
). It is enough for the normal scale application development, but if you develop the middle or large scale application, it may be not enought. You may want to control more flexible.
For example,
- You would like to define the common macro across multiple projects.
- You would like to change the search path of headers and/or libraries on each build machines.
- You would like to not save the code signing configuration into the project file.
- You would like to change the build configuration without Xcode.
You can write the configurations into the configuration settings file, and override the configurations of the project with it. This article explains how to create the Xcode configuration settings file.
Creating the configuration settings file
The configuration settings file is a text file. You can also create with the TextEditor, but you need to set it to the project file, so we create it with the Xcode.

The build configuration files are not targeted to a build target, even if the configuration is for a specific target.

The syntax of the configuration settings file
The syntax of the configuration settings file is simple. Write the configuration in each lines.
Configuration = Value
For example, if you would like to set the ONLY_ACTIVE_ARCH
to be YES
, write following line.
ONLY_ACTIVE_ARCH = YES
Comments
As with Swift code, everything after // until the end of the line is treated as a comment.
Types of the value
The type of values is different for each configurations. If you look at the build settings on Xcode, it could be a string or a number. It corresponds to that. The following types are defined.
- Boolean (
YES
orNO
) - String
- Enumeration (The predefined text)
- Space separated string list. If a string contains space, surround it with
'
. - Path. The file path and the directory path in the POSIX form.
- Space separated path list. If a path contains space, surround it with
'
.
Reference to other configuration
If you would like to use the value of the other configuration setting, write in following form.
$(Other configuration)
Inherited value
If you don’t specify the target level configuration value, the project level configuration value will be used. If the project level configuration value is not defined too, the default value will be used. Like this, the inherited value may be used.
If you write the following as value, the inherited value will be used.
$(inherited)
Use it for the configuration supporting multiple values such as the string list or the path list, you can add the element to the inherited value.
FLAGS = $(inherited) --no-timestamp
Platform specific configurations
If you would like to define the platform specific configurations, write the configuration in form of [platform=value]
. The two platform is defined.
sdk
: The cross platform sdk, such asmacos10.12
,iphoneos10.2
and so on. You can specify*
as version for hit any versions.arch
: The CPU architecture.x86_64
orarm64
.
Both of values can be spcified at one time, write in form as like configuration[sdk=macos10.12][arch=x86_64] = value
.
Import other configuration files
If you would like to import other configuration files, use #include
statement.
#include "Common.xcconfig"
In this case, the Common.xcconfig
file is imported. If the file is missing, the warning will be displayed. If you write #include?
statement, the warning will not be displayed even if the file is missing.
#include? "Option.xcconfig"
Assign the configuration settings file to the build target
To use the configuration settings file, assign it to the build target with the Xcode.

For example, if you want to assign the Debug.xcconfig
file to the Debug
configuration, click the None
in at the line “Example” project in theDebug
configuration.

Configurations List
The configurations list is available in the Apple Developer Site.