A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.adacore.com/gprbuild-docs/html/gprbuild_ug/attributes.html below:

Website Navigation


2.9.10. Attributes — GPR Tools User's Guide 26.0w documentation

2.9.10. Attributes

A project (and its packages) may have attributes that define the project’s properties. Some attributes have values that are strings; others have values that are string lists.

attribute_declaration ::=
   simple_attribute_declaration | indexed_attribute_declaration

simple_attribute_declaration ::= 'for' attribute_designator 'use' expression ;

indexed_attribute_declaration ::=
  'for' *<indexed_attribute_>*simple_name ( string_literal) 'use' expression ;

attribute_designator ::=
  <simple_attribute_>simple_name
  | <indexed_attribute_>simple_name ( string_literal )

There are two categories of attributes: simple attributes and indexed attributes. Each simple attribute has a default value: the empty string (for string attributes) and the empty list (for string list attributes). An attribute declaration defines a new value for an attribute, and overrides the previous value. The syntax of a simple attribute declaration is similar to that of an attribute definition clause in Ada.

Some attributes are indexed. These attributes are mappings whose domain is a set of strings. They are declared one association at a time, by specifying a point in the domain and the corresponding image of the attribute. Like untyped variables and simple attributes, indexed attributes may be declared several times. Each declaration supplies a new value for the attribute, and replaces the previous setting.

Here are some examples of attribute declarations:

--  simple attributes
for Object_Dir use "objects";
for Source_Dirs use ("units", "test/drivers");

--  indexed attributes
for Body ("main") use "Main.ada";
for Switches ("main.ada")
    use ("-v", "-gnatv");
for Switches ("main.ada") use Builder'Switches ("main.ada") & "-g";

--  indexed attributes copy (from package Builder in project Default)
--  The package name must always be specified, even if it is the current
--  package.
for Default_Switches use Default.Builder'Default_Switches;

When an attribute is defined in the configuration project but not in the user project, it is inherited in the user project.

When a single string attribute is defined in both the configuration project and the user project, its value in the user project is as declared; the value in the configuration project does not matter.

For string list attributes, there are two cases. Some of these attributes are configuration concatenable. For these attributes, when they are declared in both the configuration project and the user project, the final value is the concatenation of the value in the configuration project with the value in the user project. The configuration concatenable attributes are indicated in the list below.

Attributes references may appear anywhere in expressions, and are used to retrieve the value previously assigned to the attribute. If an attribute has not been set in a given package or project, its value defaults to the empty string or the empty list, with some exceptions.

attribute_reference ::=
  attribute_prefix ' <simple_attribute>_simple_name [ (string_literal) ]

attribute_prefix ::= 'project'
  | <project_>simple_name
  | package_identifier
  | <project_>simple_name . package_identifier

Here are some examples:

project'Object_Dir
Naming'Dot_Replacement
Imported_Project'Source_Dirs
Imported_Project.Naming'Casing
Builder'Default_Switches ("Ada")

The exceptions to the empty defaults are:

The prefix of an attribute may be:

In the following sections, all predefined attributes are succinctly described, first the project level attributes (that is, those attributes that are not in a package), then the attributes in the different packages.

It is possible for different tools to dynamically create new packages with attributes, or new attributes in predefined packages. These attributes are not documented here.

The attributes under Configuration headings are usually found only in configuration project files.

The characteristics of each attribute are indicated as follows:

2.9.10.1. Project Level Attributes 2.9.10.2. Package Binder Attributes 2.9.10.3. Package Builder Attributes 2.9.10.4. Package Clean Attributes 2.9.10.5. Package Compiler Attributes 2.9.10.6. Package Gnatls Attributes 2.9.10.7. Package Install Attributes 2.9.10.8. Package Linker Attributes 2.9.10.9. Package Naming Attributes

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4