Back to Cmake

ConfigurePresets Properties

Help/manual/presets/configurePresets-properties.rst

4.4.09.1 KB
Original Source

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

.. _CMakePresets.configurePresets.name:

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

.. _CMakePresets.configurePresets.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 :cmake-option:--preset argument, will not show up in the :manual:CMake GUI <cmake-gui(1)>, and does not have to have a valid generator or binaryDir, even from inheritance. hidden presets are intended to be used as a base for other presets to inherit via the inherits field.

.. _CMakePresets.configurePresets.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.configurePresets.condition:

condition .. presets-versionadded:: 3

An optional Condition_ object.

.. _CMakePresets.configurePresets.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.configurePresets.displayName:

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

.. _CMakePresets.configurePresets.description:

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

.. _CMakePresets.configurePresets.generator:

generator An optional string representing the :manual:generator <cmake-generators(7)> to use for the preset.

.. presets-versionchanged:: 3

If omitted, CMake will fall back to regular generator discovery
procedure. In previous versions, if not specified, this field
must be inherited from the ``inherits`` preset (unless this
preset is ``hidden``).

Note that for :ref:Visual Studio generators, unlike in the command line :cmake-option:-G argument, you cannot include the platform name in the generator name. Use the architecture field instead.

.. _CMakePresets.configurePresets.architecture:

architecture Optional field representing the platform for :manual:generators <cmake-generators(7)> that support it.

See :option:cmake -A for possible values.

architecture may be either a string or an object with the following fields:

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

.. _CMakePresets.configurePresets.toolset:

toolset Optional field representing the toolset for :manual:generators <cmake-generators(7)> that support it.

See :option:cmake -T for possible values.

toolset may be either a string or an object with the following fields:

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

.. _CMakePresets.configurePresets.toolchainFile:

toolchainFile .. presets-versionadded:: 3

An optional string representing the path to the toolchain file. This field supports macro expansion_. If a relative path is specified, it is calculated relative to the build directory, and if not found, relative to the source directory. This field takes precedence over any :variable:CMAKE_TOOLCHAIN_FILE value.

.. _CMakePresets.configurePresets.graphviz:

graphviz .. presets-versionadded:: 10

An optional string representing the path to the graphviz input file, that will contain all the library and executable dependencies in the project. See the documentation for :option:cmake --graphviz for more details.

This field supports macro expansion_. If a relative path is specified, it is calculated relative to the current working directory.

.. _CMakePresets.configurePresets.binaryDir:

binaryDir An optional string representing the path to the output binary directory. This field supports macro expansion_. If a relative path is specified, it is calculated relative to the source directory.

.. presets-versionchanged:: 3

If omitted, CMake will calculate the path using regular methods.
In previous versions, if not specified, this field must be
inherited from the ``inherits`` preset (unless this preset is
``hidden``).

.. _CMakePresets.configurePresets.installDir:

installDir .. presets-versionadded:: 3

An optional string representing the path to the installation directory, which will be used as the :variable:CMAKE_INSTALL_PREFIX variable. This field supports macro expansion_. If a relative path is specified, it is calculated relative to the source directory.

.. _CMakePresets.configurePresets.cmakeExecutable:

cmakeExecutable An optional string representing the path to the CMake executable to use for this preset. This is reserved for use by IDEs, and is not used by CMake itself. IDEs that use this field should expand any macros in it.

.. _CMakePresets.configurePresets.cacheVariables:

cacheVariables An optional map of cache variables. The key is the variable name (which may not be an empty string), and the value is either null, a boolean (which is equivalent to a value of "TRUE" or "FALSE" and a type of BOOL), a string representing the value of the variable (which supports macro expansion_), or an object with the following fields:

type An optional string representing the type of the variable.

value A required string or boolean representing the value of the variable. A boolean is equivalent to "TRUE" or "FALSE". This field supports macro expansion_.

Cache variables are inherited through the inherits field, and the preset's variables will be the union of its own cacheVariables and the cacheVariables 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.configurePresets.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.configurePresets.warnings:

warnings An optional object specifying the warnings to enable. The object may contain the following fields:

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

.. _CMakePresets.configurePresets.errors:

errors An optional object specifying the errors to enable. The object may contain the following fields:

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

.. _CMakePresets.configurePresets.debug:

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

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

.. _CMakePresets.configurePresets.trace:

trace .. presets-versionadded:: 7

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

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