The group directive defines a single name for a set of source files. The name of a group can be used in place of a list of string data elements that represent the names of source files.
This diagram shows the syntax of the group directive:

The group directive has the following parameters:
source_group
This parameter is the identifier that names the group being
defined.
string_list
This parameter lists the names of source files to be
included in the group.
null
This keyword creates a group that is empty.
In the following example, a source group of files is defined, and then it is used in an option directive and a source directive to specify that macros defined in the group of files have global scope:
group a = "a.h", "b.h", "c.h"
option macros(global) {
source a
}
If you are editing the configuration file directly, you can use a local variable that contains a list of file names instead of a group name. The advantage of the group directive is that, in configuration views of the IDE, files in a group are recognized as source files. The IDE cannot distinguish a variable containing file names from other variables of type string. The example above has the same effect as the following lines:
a = "a.h", "b.h", "c.h"
option macro(global) {
source a
}
The files that are named in a group directive do not become source files for your project until you use the group in a source directive. The group directive only defines the names of files that are in the group. For the same reason, options that are in effect when the group directive appears in the configuration file are not applied to source files in the group. To apply options to the source files, use the name of the group in a source directive. For example, in the lines below, the option macros(global) applies to file a.h, but not to file a.cpp:
target "a.exe" { option macros(global){ source "a.h" group a = "a.cpp" } source a }
To ensure correct handling of source files, the following processing rules apply to variables and strings that represent names of source files:
![]()
Configuration Files
How Configuration Files Are
Processed
![]()
Configuration File Directives
Build Options
