diff options
author | Brad King <brad.king@kitware.com> | 2021-02-05 11:57:18 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-02-05 11:57:28 (GMT) |
commit | 2c2eb777f4def3c82b198f9a51533aebcd8e78bc (patch) | |
tree | 5b80852ad57fa527d2ef96a9a8a4cd0c8ee7401e /Help | |
parent | cb282b2433892495f2d9848b626e6c00da6dd7d2 (diff) | |
parent | 9b5289ebd8e6e27f6d909158472b9164718a7c6b (diff) | |
download | CMake-2c2eb777f4def3c82b198f9a51533aebcd8e78bc.zip CMake-2c2eb777f4def3c82b198f9a51533aebcd8e78bc.tar.gz CMake-2c2eb777f4def3c82b198f9a51533aebcd8e78bc.tar.bz2 |
Merge topic 'build-test-presets'
9b5289ebd8 Help: Add release note for build and test presets
c8a5cd6871 Tests: Update RunCMake/CMakePresets --list-presets
69a5cf23a2 Tests: Update RunCMake/CommandLine BuildDir
b500935b94 Tests: Add test preset tests
74a86566f0 Tests: Add build preset tests
56751c83aa Tests: Factor out RunCMake.CMakePresets schema validation
676ecf0d37 cmake-presets: Add build and test presets
4f4f2028b8 Help: Add documentation for buildPresets and testPresets
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5681
Diffstat (limited to 'Help')
-rw-r--r-- | Help/manual/cmake-presets.7.rst | 495 | ||||
-rw-r--r-- | Help/manual/cmake.1.rst | 22 | ||||
-rw-r--r-- | Help/manual/ctest.1.rst | 10 | ||||
-rw-r--r-- | Help/manual/presets/schema.json | 485 | ||||
-rw-r--r-- | Help/release/dev/build-test-presets.rst | 4 |
5 files changed, 999 insertions, 17 deletions
diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst index 3ab0a62..9968239 100644 --- a/Help/manual/cmake-presets.7.rst +++ b/Help/manual/cmake-presets.7.rst @@ -71,6 +71,14 @@ The root object recognizes the following fields: An optional array of `Configure Preset`_ objects. +``buildPresets`` + + An optional array of `Build Preset`_ objects. + +``testPresets`` + + An optional array of `Test Preset`_ objects. + Configure Preset ^^^^^^^^^^^^^^^^ @@ -289,6 +297,489 @@ that may contain the following fields: An optional boolean. Setting this to ``true`` is equivalent to passing ``--debug-find`` on the command line. +Build Preset +^^^^^^^^^^^^ + +Each entry of the ``buildPresets`` array is a JSON object +that may contain the following fields: + +``name`` + + A required string representing the machine-friendly name of the preset. + This identifier is used in the ``--preset`` argument. There must not be + two presets (configure, build, or test) in the union of + ``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same + directory with the same name. + +``hidden`` + + An optional boolean specifying whether or not a preset should be hidden. + If a preset is hidden, it cannot be used in the ``--preset`` argument + and does not have to have a valid ``configurePreset``, even from + inheritance. ``hidden`` presets are intended to be used as a base for + other presets to inherit via the ``inherits`` field. + +``inherits`` + + An optional array of strings representing the names of presets to + inherit from. 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`` list + will be preferred. Presets in ``CMakePresets.json`` may not inherit from + presets in ``CMakeUserPresets.json``. + + This field can also be a string, which is equivalent to an array + containing one string. + +``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. + +``displayName`` + + An optional string with a human-friendly name of the preset. + +``description`` + + An optional string with a human-friendly description of the preset. + +``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}``.) + + 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. + +``configurePreset`` + + An optional string specifying the name of a configure preset to + associate with this build preset. If ``configurePreset`` is not + specified, it must be inherited from the inherits preset (unless this + preset is hidden). The build tree directory is inferred from the + configure preset. + +``inheritConfigureEnvironment`` + + An optional boolean that defaults to true. If true, the environment + variables from the associated configure preset are inherited after all + inherited build preset environments, but before environment variables + explicitly specified in this build preset. + +``jobs`` + + An optional integer. Equivalent to passing ``--parallel`` or ``-j`` on + the command line. + +``targets`` + + An optional string or array of strings. Equivalent to passing + ``--target`` or ``-t`` on the command line. Vendors may ignore the + targets property or hide build presets that explicitly specify targets. + This field supports macro expansion. + +``configuration`` + + An optional string. Equivalent to passing ``--config`` on the command + line. + +``cleanFirst`` + + An optional bool. If true, equivalent to passing ``--clean-first`` on + the command line. + +``verbose`` + + An optional bool. If true, equivalent to passing ``--verbose`` on the + command line. + +``nativeToolOptions`` + + An optional array of strings. Equivalent to passing options after ``--`` + on the command line. The array values support macro expansion. + +Test Preset +^^^^^^^^^^^ + +Each entry of the ``testPresets`` array is a JSON object +that may contain the following fields: + +``name`` + + A required string representing the machine-friendly name of the preset. + This identifier is used in the ``--preset`` argument. There must not be + two presets (configure, build, or test) in the union of + ``CMakePresets.json`` and ``CMakeUserPresets.json`` in the same + directory with the same name. + +``hidden`` + + An optional boolean specifying whether or not a preset should be hidden. + If a preset is hidden, it cannot be used in the ``--preset`` argument + and does not have to have a valid ``configurePreset``, even from + inheritance. ``hidden`` presets are intended to be used as a base for + other presets to inherit via the ``inherits`` field. + +``inherits`` + + An optional array of strings representing the names of presets to + inherit from. 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`` list + will be preferred. Presets in ``CMakePresets.json`` may not inherit from + presets in ``CMakeUserPresets.json``. + + This field can also be a string, which is equivalent to an array + containing one string. + +``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. + +``displayName`` + + An optional string with a human-friendly name of the preset. + +``description`` + + An optional string with a human-friendly description of the preset. + +``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}``.) + + 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. + +``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 tree directory is inferred from the + configure preset. + +``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. + +``configuration`` + + An optional string. Equivalent to passing ``--build-config`` on the + command line. + +``overwriteConfigurationFile`` + + An optional array of configuration options to overwrite options + specified in the CTest configuration file. Equivalent to passing + ``--overwrite`` for each value in the array. The array values + support macro expansion. + +``output`` + + An optional object specifying output options. The object may contain the + following fields. + + ``shortProgress`` + + An optional bool. If true, equivalent to passing ``--progress`` on the + command line. + + ``verbosity`` + + An optional string specifying verbosity level. Must be one of the + following: + + ``default`` + + Equivalent to passing no verbosity flags on the command line. + + ``verbose`` + + Equivalent to passing ``--verbose`` on the command line. + + ``extra`` + + Equivalent to passing ``--extra-verbose`` on the command line. + + ``debug`` + + An optional bool. If true, equivalent to passing ``--debug`` on the + command line. + + ``outputOnFailure`` + + An optional bool. If true, equivalent to passing + ``--output-on-failure`` on the command line. + + ``quiet`` + + An optional bool. If true, equivalent to passing ``--quiet`` on the + command line. + + ``outputLogFile`` + + An optional string specifying a path to a log file. Equivalent to + passing ``--output-log`` on the command line. This field supports + macro expansion. + + ``labelSummary`` + + An optional bool. If false, equivalent to passing + ``--no-label-summary`` on the command line. + + ``subprojectSummary`` + + An optional bool. If false, equivalent to passing + ``--no-subproject-summary`` on the command line. + + ``maxPassedTestOutputSize`` + + An optional integer specifying the maximum output for passed tests in + bytes. Equivalent to passing ``--test-output-size-passed`` on the + command line. + + ``maxFailedTestOutputSize`` + + An optional integer specifying the maximum output for failed tests in + bytes. Equivalent to passing ``--test-output-size-failed`` on the + command line. + + ``maxTestNameWidth`` + + An optional integer specifying the maximum width of a test name to + output. Equivalent to passing ``--max-width`` on the command line. + +``filter`` + + An optional object specifying how to filter the tests to run. The object + may contain the following fields. + + ``include`` + + An optional object specifying which tests to include. The object may + contain the following fields. + + ``name`` + + An optional string specifying a regex for test names. Equivalent to + passing ``--tests-regex`` on the command line. This field supports + macro expansion. + + + ``label`` + + An optional string specifying a regex for test labels. Equivalent to + passing ``--label-regex`` on the command line. This field supports + macro expansion. + + ``useUnion`` + + An optional bool. Equivalent to passing ``--union`` on the command + line. + + ``index`` + + An optional object specifying tests to include by test index. The + object may contain the following fields. Can also be an optional + string specifying a file with the command line syntax for + ``--tests-information``. If specified as a string, this field + supports macro expansion. + + ``start`` + + An optional integer specifying a test index to start testing at. + + ``end`` + + An optional integer specifying a test index to stop testing at. + + ``stride`` + + An optional integer specifying the increment. + + ``specificTests`` + + An optional array of integers specifying specific test indices to + run. + + ``exclude`` + + An optional object specifying which tests to exclude. The object may + contain the following fields. + + ``name`` + + An optional string specifying a regex for test names. Equivalent to + passing ``--exclude-regex`` on the command line. This field supports + macro expansion. + + ``label`` + + An optional string specifying a regex for test labels. Equivalent to + passing ``--label-exclude`` on the command line. This field supports + macro expansion. + + ``fixtures`` + + An optional object specifying which fixtures to exclude from adding + tests. The object may contain the following fields. + + ``any`` + + An optional string specifying a regex for text fixtures to exclude + from adding any tests. Equivalent to ``--fixture-exclude-any`` on + the command line. This field supports macro expansion. + + ``setup`` + + An optional string specifying a regex for text fixtures to exclude + from adding setup tests. Equivalent to ``--fixture-exclude-setup`` + on the command line. This field supports macro expansion. + + ``cleanup`` + + An optional string specifying a regex for text fixtures to exclude + from adding cleanup tests. Equivalent to + ``--fixture-exclude-cleanup`` on the command line. This field + supports macro expansion. + +``execution`` + + An optional object specifying options for test execution. The object may + contain the following fields. + + ``stopOnFailure`` + + An optional bool. If true, equivalent to passing ``--stop-on-failure`` + on the command line. + + ``enableFailover`` + + An optional bool. If true, equivalent to passing ``-F`` on the command + line. + + ``jobs`` + + An optional integer. Equivalent to passing ``--parallel`` on the + command line. + + ``resourceSpecFile`` + + An optional string. Equivalent to passing ``--resource-spec-file`` on + the command line. This field supports macro expansion. + + ``testLoad`` + + An optional integer. Equivalent to passing ``--test-load`` on the + command line. + + ``showOnly`` + + An optional string. Equivalent to passing ``--show-only`` on the + command line. The string must be one of the following values: + + ``human`` + + ``json-v1`` + + ``rerunFailed`` + + An optional bool. If true, equivalent to passing ``--rerun-failed`` on + the command line. + + ``repeat`` + + An optional object specifying how to repeat tests. Equivalent to + passing ``--repeat`` on the command line. The object must have the + following fields. + + ``mode`` + + A required string. Must be one of the following values: + + ``until-fail`` + + ``until-pass`` + + ``after-timeout`` + + ``count`` + + A required integer. + + ``interactiveDebugging`` + + An optional bool. If true, equivalent to passing + ``--interactive-debug-mode 1`` on the command line. If false, + equivalent to passing ``--interactive-debug-mode 0`` on the command + line. + + ``scheduleRandom`` + + An optional bool. If true, equivalent to passing ``--schedule-random`` + on the command line. + + ``timeout`` + + An optional integer. Equivalent to passing ``--timeout`` on the + command line. + + ``noTestsAction`` + + An optional string specifying the behavior if no tests are found. Must + be one of the following values: + + ``default`` + + Equivalent to not passing any value on the command line. + + ``error`` + + Equivalent to passing ``--no-tests=error`` on the command line. + + ``ignore`` + + Equivalent to passing ``--no-tests=ignore`` on the command line. + Macro Expansion ^^^^^^^^^^^^^^^ @@ -326,7 +817,9 @@ Recognized macros include: ``${generator}`` - Generator specified in the preset's ``generator`` field. + Generator specified in the preset's ``generator`` field. For build and + test presets, this will evaluate to the generator specified by + ``configurePreset``. ``${dollar}`` diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 7efe0cd..b2bd1ed 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -382,7 +382,8 @@ Options ``<path-to-source>/CMakePresets.json`` and ``<path-to-source>/CMakeUserPresets.json``. The preset specifies the generator and the build directory, and optionally a list of variables and - other arguments to pass to CMake. The :manual:`CMake GUI <cmake-gui(1)>` can + other arguments to pass to CMake. The current working directory must contain + CMake preset files. The :manual:`CMake GUI <cmake-gui(1)>` can also recognize ``CMakePresets.json`` and ``CMakeUserPresets.json`` files. For full details on these files, see :manual:`cmake-presets(7)`. @@ -392,6 +393,10 @@ Options a variable called ``MYVAR`` to ``1``, but the user sets it to ``2`` with a ``-D`` argument, the value ``2`` is preferred. +``--list-presets, --list-presets=<[configure | build | test | all]>`` + Lists the available presets. If no option is specified only configure presets + will be listed. The current working directory must contain CMake preset files. + .. _`Build Tool Mode`: Build a Project @@ -402,13 +407,24 @@ project binary tree: .. code-block:: shell - cmake --build <dir> [<options>] [-- <build-tool-options>] + cmake --build [<dir> | --preset <preset>] [<options>] [-- <build-tool-options>] This abstracts a native build tool's command-line interface with the following options: ``--build <dir>`` - Project binary directory to be built. This is required and must be first. + Project binary directory to be built. This is required (unless a preset + is specified) and must be first. + +``--preset <preset>`` + Use a build preset to specify build options. The project binary directory + is inferred from the ``configurePreset`` key. The current working directory + must contain CMake preset files. + See :manual:`preset <cmake-presets(7)>` for more details. + +``--list-presets`` + Lists the available build presets. The current working directory must + contain CMake preset files. ``--parallel [<jobs>], -j [<jobs>]`` The maximum number of concurrent processes to use when building. diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 16afcec..43157b6 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -28,6 +28,16 @@ This program will run the tests and report results. Options ======= +``--preset <preset>`` + Use a test preset to specify test options. The project binary directory + is inferred from the ``configurePreset`` key. The current working directory + must contain CMake preset files. + See :manual:`preset <cmake-presets(7)>` for more details. + +``--list-presets`` + Lists the available test presets. The current working directory must contain + CMake preset files. + ``-C <cfg>, --build-config <cfg>`` Choose configuration to test. diff --git a/Help/manual/presets/schema.json b/Help/manual/presets/schema.json index 57b063e..ffbd7fe 100644 --- a/Help/manual/presets/schema.json +++ b/Help/manual/presets/schema.json @@ -2,13 +2,38 @@ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "description": "The presets specify the generator and the build directory, and optionally a list of variables and other arguments to pass to CMake.", - "properties": { - "version": { - "type": "integer", - "description": "A required integer representing the version of the JSON schema. Currently, the only supported version is 1.", - "minimum": 1, - "maximum": 1 + "oneOf": [ + { + "properties": { + "version": { + "const": 1, + "description": "A required integer representing the version of the JSON schema." + }, + "cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired"}, + "vendor": { "$ref": "#/definitions/vendor" }, + "configurePresets": { "$ref": "#/definitions/configurePresets"} + }, + "additionalProperties": false }, + { + "properties": { + "version": { + "const": 2, + "description": "A required integer representing the version of the JSON schema." + }, + "cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired"}, + "vendor": { "$ref": "#/definitions/vendor" }, + "configurePresets": { "$ref": "#/definitions/configurePresets"}, + "buildPresets": { "$ref": "#/definitions/buildPresets"}, + "testPresets": { "$ref": "#/definitions/testPresets"} + }, + "additionalProperties": false + } + ], + "required": [ + "version" + ], + "definitions": { "cmakeMinimumRequired": { "type": "object", "description": "An optional object representing the minimum version of CMake needed to build this project.", @@ -47,7 +72,7 @@ }, "hidden": { "type": "boolean", - "description": "An optional boolean specifying whether or not a preset should be hidden. If a preset is hidden, it cannot be used in the --preset= argument, will not show up in the CMake GUI, 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." + "description": "An optional boolean specifying whether or not a preset should be hidden. If a preset is hidden, it cannot be used in the --preset= argument, will not show up in the CMake GUI, 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." }, "inherits": { "anyOf": [ @@ -58,7 +83,7 @@ }, { "type": "array", - "description": "An optional array of strings representing the names of presets to inherit from. The preset will inherit all of the fields from the inherits presets by default (except name, hidden, inherits, description, and longDescription), but can override them as desired. If multiple inherits presets provide conflicting values for the same field, the earlier preset in the inherits list will be preferred. Presets in CMakePresets.json may not inherit from presets in CMakeUserPresets.json.", + "description": "An optional array of strings representing the names of presets to inherit from. 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 list will be preferred. Presets in CMakePresets.json may not inherit from presets in CMakeUserPresets.json.", "items": { "type": "string", "description": "An optional string representing the name of the preset to inherit from.", @@ -283,10 +308,444 @@ ], "additionalProperties": false } + }, + "buildPresets": { + "type": "array", + "description": "An optional array of build preset objects. Used to specify arguments to cmake --build. Available in version 2 and higher.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "A required string representing the machine-friendly name of the preset. This identifier is used in the --preset argument. There must not be two presets (configure, build, or test) in the union of CMakePresets.json and CMakeUserPresets.json in the same directory with the same name.", + "minLength": 1 + }, + "hidden": { + "type": "boolean", + "description": "An optional boolean specifying whether or not a preset should be hidden. If a preset is hidden, it cannot be used in the --preset argument, will not show up in the CMake GUI, and does not have to have a valid configurePreset, even from inheritance. Hidden presets are intended to be used as a base for other presets to inherit via the inherits field." + }, + "inherits": { + "anyOf": [ + { + "type": "string", + "description": "An optional string representing the name of the build preset to inherit from.", + "minLength": 1 + }, + { + "type": "array", + "description": "An optional array of strings representing the names of build presets to inherit from. 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 list will be preferred. Presets in CMakePresets.json may not inherit from presets in CMakeUserPresets.json.", + "items": { + "type": "string", + "description": "An optional string representing the name of the preset to inherit from.", + "minLength": 1 + } + } + ] + }, + "configurePreset": { + "type": "string", + "description": "An optional string specifying the name of a configure preset to associate with this build preset. If configurePreset is not specified, it must be inherited from the inherits preset (unless this preset is hidden). The build tree directory is inferred from the configure preset.", + "minLength": 1 + }, + "vendor": { + "type": "object", + "description": "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.", + "properties": {} + }, + "displayName": { + "type": "string", + "description": "An optional string with a human-friendly name of the preset." + }, + "description": { + "type": "string", + "description": "An optional string with a human-friendly description of the preset." + }, + "inheritConfigureEnvironment": { + "type": "boolean", + "description": "An optional Boolean that defaults to true. If true, the environment variables from the associated configure preset are inherited after all inherited build preset environments, but before environment variables explicitly specified in this build preset." + }, + "environment": { + "type": "object", + "description": "An optional map of environment variables. The key is the variable name (which must not be an empty string). 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}.) 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.", + "properties": {}, + "additionalProperties": { + "anyOf": [ + { + "type": "null", + "description": "Setting a variable to null causes it to not be set, even if a value was inherited from another preset." + }, + { + "type": "string", + "description": "A string representing the value of the variable." + } + ] + }, + "propertyNames": { + "pattern": "^.+$" + } + }, + "jobs": { + "type": "integer", + "description": "An optional integer. Equivalent to passing --parallel or -j on the command line." + }, + "targets": { + "anyOf": [ + { + "type": "string", + "description": "An optional string. Equivalent to passing --target or -t on the command line. Vendors may ignore the targets property or hide build presets that explicitly specify targets." + }, + { + "type": "array", + "description": "An optional array of strings. Equivalent to passing --target or -t on the command line. Vendors may ignore the targets property or hide build presets that explicitly specify targets.", + "items": { + "type": "string", + "description": "An optional string. Equivalent to passing --target or -t on the command line. Vendors may ignore the targets property or hide build presets that explicitly specify targets." + } + } + ] + }, + "configuration": { + "type": "string", + "description": "An optional string. Equivalent to passing --config on the command line." + }, + "cleanFirst": { + "type": "boolean", + "description": "An optional bool. If true, equivalent to passing --clean-first on the command line." + }, + "verbose": { + "type": "boolean", + "description": "An optional bool. If true, equivalent to passing --verbose on the command line." + }, + "nativeToolOptions": { + "type": "array", + "description": "An optional array of strings. Equivalent to passing options after -- on the command line.", + "items": { + "type": "string", + "description": "An optional string representing an option to pass after -- on the command line." + } + } + }, + "required": [ + "name" + ], + "additionalProperties": false + } + }, + "testPresets": { + "type": "array", + "description": "An optional array of test preset objects. Used to specify arguments to ctest. Available in version 2 and higher.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "A required string representing the machine-friendly name of the preset. This identifier is used in the --preset argument. There must not be two presets (configure, build, or test) in the union of CMakePresets.json and CMakeUserPresets.json in the same directory with the same name.", + "minLength": 1 + }, + "hidden": { + "type": "boolean", + "description": "An optional boolean specifying whether or not a preset should be hidden. If a preset is hidden, it cannot be used in the --preset argument, will not show up in the CMake GUI, and does not have to have a valid configurePreset, even from inheritance. Hidden presets are intended to be used as a base for other presets to inherit via the inherits field." + }, + "inherits": { + "anyOf": [ + { + "type": "string", + "description": "An optional string representing the name of the test preset to inherit from.", + "minLength": 1 + }, + { + "type": "array", + "description": "An optional array of strings representing the names of test presets to inherit from. 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 list will be preferred. Presets in CMakePresets.json may not inherit from presets in CMakeUserPresets.json.", + "items": { + "type": "string", + "description": "An optional string representing the name of the preset to inherit from.", + "minLength": 1 + } + } + ] + }, + "configurePreset": { + "type": "string", + "description": "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 tree directory is inferred from the configure preset.", + "minLength": 1 + }, + "vendor": { + "type": "object", + "description": "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.", + "properties": {} + }, + "displayName": { + "type": "string", + "description": "An optional string with a human-friendly name of the preset." + }, + "description": { + "type": "string", + "description": "An optional string with a human-friendly description of the preset." + }, + "inheritConfigureEnvironment": { + "type": "boolean", + "description": "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." + }, + "environment": { + "type": "object", + "description": "An optional map of environment variables. The key is the variable name (which must not be an empty string). 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}.) 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.", + "properties": {}, + "additionalProperties": { + "anyOf": [ + { + "type": "null", + "description": "Setting a variable to null causes it to not be set, even if a value was inherited from another preset." + }, + { + "type": "string", + "description": "A string representing the value of the variable." + } + ] + }, + "propertyNames": { + "pattern": "^.+$" + } + }, + "configuration": { + "type": "string", + "description": "An optional string. Equivalent to passing --build-config on the command line." + }, + "overwriteConfigurationFile": { + "type": "array", + "description": "An optional array of configuration options to overwrite options specified in the CTest configuration file. Equivalent to passing ``--overwrite`` for each value in the array.", + "items": { + "type": "string", + "description": "An option written as a key-value pair in the form \"key=value\"." + } + }, + "output": { + "type": "object", + "description": "An optional object specifying output options.", + "properties": { + "shortProgress": { + "type": "boolean", + "description": "An optional bool. If true, equivalent to passing --progress on the command line." + }, + "verbosity": { + "type": "string", + "description": "An optional string specifying verbosity level. Valid values are \"default\" (equivalent to passing no verbosity flags on the command line), \"verbose\" (equivalent to passing --verbose on the command line), and \"extra\" (equivalent to passing --extra-verbose on the command line).", + "enum": [ + "default", "verbose", "extra" + ] + }, + "debug": { + "type": "boolean", + "description": "An optional bool. If true, equivalent to passing --debug on the command line." + }, + "outputOnFailure": { + "type": "boolean", + "description": "An optional bool. If true, equivalent to passing --output-on-failure on the command line." + }, + "quiet": { + "type": "boolean", + "description": "An optional bool. If true, equivalent to passing --quiet on the command line." + }, + "outputLogFile": { + "type": "string", + "description": "An optional string specifying a path to a log file. Equivalent to passing --output-log on the command line." + }, + "labelSummary": { + "type": "boolean", + "description": "An optional bool. If false, equivalent to passing --no-label-summary on the command line." + }, + "subprojectSummary": { + "type": "boolean", + "description": "An optional bool. If false, equivalent to passing --no-subproject-summary on the command line." + }, + "maxPassedTestOutputSize": { + "type": "integer", + "description": "An optional integer specifying the maximum output for passed tests in bytes. Equivalent to passing --test-output-size-passed on the command line." + }, + "maxFailedTestOutputSize": { + "type": "integer", + "description": "An optional integer specifying the maximum output for failed tests in bytes. Equivalent to passing --test-output-size-failed on the command line." + }, + "maxTestNameWidth": { + "type": "integer", + "description": "An optional integer specifying the maximum width of a test name to output. Equivalent to passing --max-width on the command line." + } + }, + "additionalProperties": false + }, + "filter": { + "type": "object", + "description": "An optional object specifying how to filter the tests to run.", + "properties": { + "include": { + "type": "object", + "description": "An optional object specifying which tests to include.", + "properties": { + "name": { + "type": "string", + "description": "An optional string specifying a regex for test names. Equivalent to passing --tests-regex on the command line." + }, + "label": { + "type": "string", + "description": "An optional string specifying a regex for test labels. Equivalent to passing --label-regex on the command line." + }, + "index": { + "anyOf": [ + { + "type": "object", + "description": "An optional object specifying tests to include by test index.", + "properties": { + "start": { + "type": "integer", + "description": "An optional integer specifying a test index to start testing at." + }, + "end": { + "type": "integer", + "description": "An optional integer specifying a test index to stop testing at." + }, + "stride": { + "type": "integer", + "description": "An optional integer specifying the increment." + }, + "specificTests": { + "type": "array", + "description": "An optional array of integers specifying specific test indices to run.", + "items": { + "type": "integer", + "description": "An integer specifying the test to run by index." + } + } + }, + "additionalProperties": false + }, + { + "type": "string", + "description": "An optional string specifying a file with the command line syntax for --tests-information." + } + ] + }, + "useUnion": { + "type": "boolean", + "description": "An optional bool. Equivalent to passing --union on the command line." + } + }, + "additionalProperties": false + }, + "exclude": { + "type": "object", + "description": "An optional object specifying which tests to exclude.", + "properties": { + "name": { + "type": "string", + "description": "An optional string specifying a regex for test names. Equivalent to passing --exclude-regex on the command line." + }, + "label": { + "type": "string", + "description": "An optional string specifying a regex for test labels. Equivalent to passing --label-exclude on the command line." + }, + "fixtures": { + "type": "object", + "description": "An optional object specifying which fixtures to exclude from adding tests.", + "properties": { + "any": { + "type": "string", + "description": "An optional string specifying a regex for text fixtures to exclude from adding any tests. Equivalent to --fixture-exclude-any on the command line." + }, + "setup": { + "type": "string", + "description": "An optional string specifying a regex for text fixtures to exclude from adding setup tests. Equivalent to --fixture-exclude-setup on the command line." + }, + "cleanup": { + "type": "string", + "description": "An optional string specifying a regex for text fixtures to exclude from adding cleanup tests. Equivalent to --fixture-exclude-cleanup on the command line." + } + }, + "additionalProperties": false + } + } + } + }, + "additionalProperties": false + }, + "execution": { + "type": "object", + "description": "An optional object specifying options for test execution.", + "properties": { + "stopOnFailure": { + "type": "boolean", + "description": "An optional bool. If true, equivalent to passing --stop-on-failure on the command line." + }, + "enableFailover": { + "type": "boolean", + "description": "An optional bool. If true, equivalent to passing -F on the command line." + }, + "jobs": { + "type": "integer", + "description": "An optional integer. Equivalent to passing --parallel on the command line." + }, + "resourceSpecFile": { + "type": "string", + "description": "An optional string. Equivalent to passing --resource-spec-file on the command line." + }, + "testLoad": { + "type": "integer", + "description": "An optional integer. Equivalent to passing --test-load on the command line." + }, + "showOnly": { + "type": "string", + "description": "An optional string. Equivalent to passing --show-only on the command line. Value must be \"human\" or \"json-v1\".", + "enum": [ + "human", "json-v1" + ] + }, + "repeat": { + "type": "object", + "description": "An optional object specifying how to repeat tests. Equivalent to passing --repeat on the command line.", + "properties": { + "mode": { + "type": "string", + "description": "A required string. Must be one of the following values: \"until-fail\", \"until-pass\", or \"after-timeout\".", + "enum": [ + "until-fail", "until-pass", "after-timeout" + ] + }, + "count": { + "type": "integer", + "description": "A required integer." + } + }, + "required": [ + "mode", "count" + ], + "additionalProperties": false + }, + "interactiveDebugging": { + "type": "boolean", + "description": "An optional bool. If true, equivalent to passing --interactive-debug-mode 1 on the command line. If false, equivalent to passing --interactive-debug-mode 0 on the command line." + }, + "scheduleRandom": { + "type": "boolean", + "description": "An optional bool. If true, equivalent to passing --schedule-random on the command line." + }, + "timeout": { + "type": "integer", + "description": "An optional integer. Equivalent to passing --timeout on the command line." + }, + "noTestsAction": { + "type": "string", + "description": "An optional string specifying the behavior if no tests are found. Must be one of the following values: \"default\" (equivalent to not passing any value on the command line), \"error\" (equivalent to passing --no-tests=error on the command line), or \"ignore\" (equivalent to passing --no-tests-ignore on the command line).", + "enum": [ + "default", "error", "ignore" + ] + } + }, + "additionalProperties": false + } + }, + "required": [ + "name" + ], + "additionalProperties": false + } } - }, - "required": [ - "version" - ], - "additionalProperties": false + } } diff --git a/Help/release/dev/build-test-presets.rst b/Help/release/dev/build-test-presets.rst new file mode 100644 index 0000000..71d14bf --- /dev/null +++ b/Help/release/dev/build-test-presets.rst @@ -0,0 +1,4 @@ +build-test-presets +------------------ + +* :manual:`cmake-presets(7)` gained support for build and test presets. |