Name

Command cdl_option — Define a single configuration option

Synopsis

cdl_option <name> {
  …
}

Description

The option is the basic unit of configurability. Generally each option corresponds to a single user choice. Typically there is a certain amount of information associated with an option to assist the user in manipulating that option, for example a textual description. There will also be some limits on the possible values that the user can choose, so an option may be a simple yes-or-no choice or it may be something more complicated such as an array size or a device name. Options may have associated constraints, so if that option is enabled then certain conditions have to satisfied elsewhere in the configuration. Options usually have direct consequences such as preprocessor #define symbols in a configuration header file.

cdl_option is implemented as a Tcl command that takes two arguments, a name and a body. The name must be a valid C preprocessor identifier: a sequence of upper or lower case letters, digits or underscores, starting with a non-digit character; identifiers beginning with an underscore should normally be avoided because they may clash with system packages or with identifiers reserved for use by the compiler. Within a single configuration, names must be unique. If a configuration contained two packages which defined the same entity CYGIMP_SOME_OPTION, any references to that entity in a requires property or any other expression would be ambiguous. It is possible for a given name to be used by two different packages if those packages should never be loaded into a single configuration. For example, architectural HAL packages are allowed to re-use names because a single configuration cannot target two different architectures. For a recommended naming convention see Section 2.3, “Package Contents and Layout”.

The second argument to cdl_option is a body of properties, typically surrounded by braces so that the Tcl interpreter treats it as a single argument. This body will be processed by a recursive invocation of the Tcl interpreter, extended with additional commands for the various properties that are allowed inside a cdl_option. The valid properties are:

active_if

Allow additional control over the active state of this option.

calculated

The option's value is not directly user-modifiable, it is calculated using a suitable CDL expression.

compile

List the source files that should be built if this option is active and enabled.

default_value

Provide a default value for this option using a CDL expression.

define

Specify additional #define symbols that should go into the owning package's configuration header file.

define_format

Control how the option's value will appear in the configuration header file.

define_proc

Use a fragment of Tcl code to output additional data to configuration header files.

description

Provide a textual description for this option.

display

Provide a short string describing this option.

doc

The location of on-line documentation for this option.

flavor

Specify the nature of this option.

if_define

Output a common preprocessor construct to a configuration header file.

implements

Enabling this option provides one instance of a more general interface.

legal_values

Impose constraints on the possible values for this option.

make

An additional custom build step associated with this option, resulting in a target that should not go directly into a library.

make_object

An additional custom build step associated with this option, resulting in an object file that should go into a library.

no_define

Suppress the normal generation of a preprocessor #define symbol in a configuration header file.

parent

Control the location of this option in the configuration hierarchy.

requires

List constraints that the configuration should satisfy if this option is active and enabled.

Example

cdl_option CYGDBG_INFRA_DEBUG_PRECONDITIONS {
  display       "Preconditions"
  default_value 1
  description   "
    This option allows individual control of preconditions.
    A precondition is one type of assert, which it is
    useful to control separately from more general asserts.
    The function is CYG_PRECONDITION(condition,msg)."
}

See Also

Command cdl_component, command cdl_package, command cdl_interface.