Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Build Setting Layers

Build setting specifications are defined in a number of layers depending on whether you build using the Xcode application or the xcodebuild tool. Figure 25-2 shows these layers.


Figure 25-2  Build setting layers

Figure 25-2 Build setting layers

The specifications of build settings configured in higher layers override the specifications set at lower layers. The following sections describe each of the build system layers in detail:

  1. Command-line layer (xcodebuild only)

    The xcodebuild tool’s command invocation represents the highest layer in which you can configure build settings when building a product. The build settings configured in this layer are accessible only to xcodebuild.

    This layer gives you a way to customize builds done in batch mode from the command line without needing access to the Xcode application.

  2. Build style layer

    The build style layer is available to both the Xcode application and the xcodebuild tool. It defines build setting variations for a build. These are changes to build setting definitions in the target layer and lower layers that allow you to produce different “flavors” of a product without having to create separate targets.

    Another use of the build style layer is to provide values for build settings to be shared by more than one target. All targets have access to the build settings in the active build style. When you have multiple targets with build settings that should be synchronized, a build style can be a convenient way to do so. See “Build Setting Evaluation” for details.

    For more information on build styles, see “Build Styles.”

  3. Target layer

    This is the main layer for specifying how a product is built. Generally, it’s the one that defines the largest number of build settings.

    The Xcode user interface displays most of the build settings defined in this layer. However, the specifications displayed may not correspond to the values the build system obtains when building a product, unless you’ve customized the specification. For example, Installation Path (INSTALL_PATH) has a default value of /usr/local/lib for targets that produce a static library. This value is not shown in the target inspector; that is, the value shown for Installation Path is empty. But if you set the build setting to $(INSTALL_PATH)/mylib in the target inspector, at build time, INSTALL_PATH is /usr/local/lib/mylib.

    Each target has its own set of build settings. That is, Xcode evaluates build settings for a target independently from the build settings defined in other targets. This is true even for dependent and aggregate targets.

    For more information on targets, see “Targets.”

  4. Project layer

    Xcode and xcodebuild use the Project layer to specify project-wide aspects, such as the location of the project itself. Build settings such as TEMP_DIR are specified in this layer. There is no mechanism for you to add build settings to this layer or modify the build setting specifications in it because you customize them in higher layers.

    Note:  The SYMROOT, OBJROOT and SDKROOT build settings are exceptions. Xcode provides a user interface for modifying these build settings in the project inspector. The SYMROOT and OBJROOT build settings identify the build locations for build products and intermediate build files, respectively. The interface for setting these locations is described in “Build Locations.” The SDKROOT build setting specifies the path to the SDK to build against; “Using Cross-Development in Xcode” describes how to choose an SDK in the project inspector.

  5. Environment layer

    The environment layer is composed of environment variables that correspond to build setting names. You can use it to configure build settings that must apply to more than one project. This layer, however, cannot access build settings configured in any other layer. For example, defining an environment variable named MY_PRODUCT_NAME as My Company $(PRODUCT_NAME) results in an undefined-variable error, unless you also define an environment variable named PRODUCT_NAME.

    You must follow the syntax described in “Build Setting Syntax” when defining the environment variables in your session.

    Note:  If you associate additional compiler flags with a file, as described in “Per-File Compiler Flags,” those flags will always be used when the file is processed as part of a build. They cannot be overridden in any of the build setting layers.



< Previous PageNext Page > Hide TOC


Last updated: 2006-11-07




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice