Configuration files contain a sequence of directives that control the build process. The way target files relate to source files, and what options apply to targets and sources, is determined by how directives are combined in the configuration file.
Directives can stand alone or have blocks of subdirectives enclosed in braces, { and }. The braces delimit a directive block and define the scope of a directive. Directive blocks can be nested. The following example contains two directive blocks. The source directive is a subdirective of the option directive and is the only directive in its block. Together, the inner block and the option directive make an outer block. Both the source directive and the option directive are subdirectives of the target directive.
target "day.exe" {
option macros(global) {
source "am.hpp", "am.cpp", "pm.cpp", "pm.hpp"
}
}
Directives can also have attributes that apply to their subdirectives. In the following example, lang(oldDigraphs) is an attribute of the option directive. This attribute applies to source file day.cpp, but not to source file night.cpp
option lang(oldDigraphs) {
source "day.cpp"
}
source "night.cpp"
Directives often contain names of options used by processes that run during builds. For example lang(oldDigraphs) in the code above is a language option that applies to C++ sources. Directives can also contain the following elements:
The directives used in configuration files are listed below:
| = (assign) | Assigns values to variables |
| error | Terminates the build with a message |
| for | Processes directives repeatedly |
| group | Assigns a list of source files to a group |
| if | Conditionally processes directives |
| include | Includes textual content of other files containing directives |
| option | Set options that control how targets are built from sources |
| perform | Controls scope of variables |
| run | Runs programs, apart from built-in processes such as compile and link, during the build. |
| source | Names input files |
| target | Names and specifies types of output files |
| tool | Identifies a program that is to be loaded for use like a built-in process |
Example of a Configuration File
![]()
Incremental C++ Builds
C Compilation
Configuration Files
How Configuration Files Are
Processed
![]()
Configuration File Syntax
Data Elements in Configuration Files
Variables in Configuration Files
Environment Variables in Configuration
Files
Expressions in Configuration Files
