Back to Cmake

TestPresets Properties

Help/manual/presets/testPresets-properties.rst

4.4.05.6 KB
Original Source

.. This file was generated by Utilities/Scripts/regenerate-presets.py from Help/manual/presets/schema.yaml. Do not edit.

.. _CMakePresets.testPresets.name:

name A required string representing the machine-friendly name of the preset. This identifier is used in the :option:ctest --preset option. There must not be two test presets in the union of CMakePresets.json and CMakeUserPresets.json in the same directory with the same name. However, a test preset may have the same name as a configure, build, package, or workflow preset.

.. _CMakePresets.testPresets.hidden:

hidden An optional boolean specifying whether or not a preset should be hidden. If a preset is hidden, it cannot be used in the :ctest-option:--preset argument and does not have to have a valid :preset:testPresets.configurePreset, even from inheritance. hidden presets are intended to be used as a base for other presets to inherit via the :preset:testPresets.inherits field.

.. _CMakePresets.testPresets.inherits:

inherits An optional array of strings representing the names of presets from which to inherit. This field can also be a string, which is equivalent to an array containing one string.

The preset will inherit all of the fields from the inherits presets by default (except name, hidden, inherits, description, and displayName), but can override them as desired. If multiple inherits presets provide conflicting values for the same field, the earlier preset in the inherits array will be preferred.

A preset can only inherit from another preset that is defined in the same file or in one of the files it includes (directly or indirectly). Presets in CMakePresets.json may not inherit from presets in CMakeUserPresets.json.

.. _CMakePresets.testPresets.condition:

condition .. presets-versionadded:: 3

An optional Condition_ object.

.. _CMakePresets.testPresets.vendor:

vendor An optional map containing vendor-specific information. CMake does not interpret the contents of this field except to verify that it is a map if it does exist. However, it should follow the same conventions as the root-level vendor field. If vendors use their own per-preset vendor field, they should implement inheritance in a sensible manner when appropriate.

.. _CMakePresets.testPresets.displayName:

displayName An optional string with a human-friendly name of the preset.

.. _CMakePresets.testPresets.description:

description An optional string with a human-friendly description of the preset.

.. _CMakePresets.testPresets.environment:

environment An optional map of environment variables. The key is the variable name (which may not be an empty string), and the value is either null or a string representing the value of the variable. Each variable is set regardless of whether or not a value was given to it by the process's environment.

This field supports macro expansion_, and environment variables in this map may reference each other, and may be listed in any order, as long as such references do not cause a cycle (for example, if ENV_1 is $env{ENV_2}, ENV_2 may not be $env{ENV_1}). $penv{NAME} allows one to prepend or append values to existing environment variables by accessing only values from the parent environment.

Environment variables are inherited through the inherits field, and the preset's environment will be the union of its own environment and the environment from all its parents. If multiple presets in this union define the same variable, the standard rules of inherits are applied. Setting a variable to null causes it to not be set, even if a value was inherited from another preset.

.. _CMakePresets.testPresets.configurePreset:

configurePreset An optional string specifying the name of a configure preset to associate with this test preset. If configurePreset is not specified, it must be inherited from the inherits preset (unless this preset is hidden). The build directory is inferred from the configure preset, so tests will run in the same binaryDir that the configuration and build used.

.. _CMakePresets.testPresets.inheritConfigureEnvironment:

inheritConfigureEnvironment An optional boolean that defaults to true. If true, the environment variables from the associated configure preset are inherited after all inherited test preset environments, but before environment variables explicitly specified in this test preset.

.. _CMakePresets.testPresets.configuration:

configuration An optional string. Equivalent to passing :ctest-option:--build-config on the command line.

.. _CMakePresets.testPresets.overwriteConfigurationFile:

overwriteConfigurationFile An optional array of configuration options to overwrite options specified in the CTest configuration file. Equivalent to passing :ctest-option:--overwrite for each value in the array. The array values support macro expansion_.

.. _CMakePresets.testPresets.output:

output An optional object specifying output options. The object may contain the following fields:

.. include:: presets/testOutput-properties.rst

.. _CMakePresets.testPresets.filter:

filter An optional object specifying how to filter the tests to run. The object may contain the following fields:

.. include:: presets/filter-properties.rst

.. _CMakePresets.testPresets.execution:

execution An optional object specifying options for test execution. The object may contain the following fields:

.. include:: presets/execution-properties.rst