diff options
author | Brad King <brad.king@kitware.com> | 2022-01-10 22:11:55 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-01-10 22:12:03 (GMT) |
commit | 39eabc17c466d79c5e16cef236194d55a152a832 (patch) | |
tree | 8b2001fd5983976b28e820160e096b5229a18fe4 /Help | |
parent | b9a40fd7ba0e9d0b63b9bb8ba57bd3c07c0c100c (diff) | |
parent | 26a5512c0f952333f089a08b0df84e3efa7fb063 (diff) | |
download | CMake-39eabc17c466d79c5e16cef236194d55a152a832.zip CMake-39eabc17c466d79c5e16cef236194d55a152a832.tar.gz CMake-39eabc17c466d79c5e16cef236194d55a152a832.tar.bz2 |
Merge topic 'cmake-presets-include'
26a5512c0f CMakePresets: Add include field
a239f23a98 Refactor: Generalize file graph in CMakePresets
84d440caac Refactor: Split JSON processing into configure, build, and test presets
fd6ea2f67f Refactor: Rename cmCMakePresetsFile to cmCMakePresetsGraph
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6829
Diffstat (limited to 'Help')
-rw-r--r-- | Help/manual/cmake-presets.7.rst | 28 | ||||
-rw-r--r-- | Help/manual/presets/example.json | 2 | ||||
-rw-r--r-- | Help/manual/presets/schema.json | 22 | ||||
-rw-r--r-- | Help/release/dev/cmake-presets-include.rst | 6 |
4 files changed, 54 insertions, 4 deletions
diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst index 74e9fae..474e1aa 100644 --- a/Help/manual/cmake-presets.7.rst +++ b/Help/manual/cmake-presets.7.rst @@ -12,9 +12,10 @@ Introduction One problem that CMake users often face is sharing settings with other people for common ways to configure a project. This may be done to support CI builds, -or for users who frequently use the same build. CMake supports two files, +or for users who frequently use the same build. CMake supports two main files, ``CMakePresets.json`` and ``CMakeUserPresets.json``, that allow users to -specify common configure options and share them with others. +specify common configure options and share them with others. CMake also +supports files included with the ``include`` field. ``CMakePresets.json`` and ``CMakeUserPresets.json`` live in the project's root directory. They both have exactly the same format, and both are optional @@ -26,6 +27,21 @@ builds. ``CMakePresets.json`` may be checked into a version control system, and is using Git, ``CMakePresets.json`` may be tracked, and ``CMakeUserPresets.json`` should be added to the ``.gitignore``. +``CMakePresets.json`` and ``CMakeUserPresets.json`` can include other files +with the ``include`` field in file version ``4`` and later. Files included by +these files can also include other files. If a preset file contains presets +that inherit from presets in another file, the file must include the other file +either directly or indirectly. Include cycles are not allowed among files (if +``a.json`` includes ``b.json``, ``b.json`` cannot include ``a.json``). However, +a file may be included multiple times from the same file or from different +files. If ``CMakePresets.json`` and ``CMakeUserPresets.json`` are both present, +``CMakeUserPresets.json`` implicitly includes ``CMakePresets.json``, even with +no ``include`` field, in all versions of the format. Files directly or +indirectly included from ``CMakePresets.json`` must be inside the project +directory. This restriction does not apply to ``CMakeUserPresets.json`` and +files that it includes, unless those files are also included by +``CMakePresets.json``. + Format ====== @@ -39,7 +55,7 @@ The root object recognizes the following fields: ``version`` A required integer representing the version of the JSON schema. - The supported versions are ``1``, ``2``, and ``3``. + The supported versions are ``1``, ``2``, ``3``, and ``4``. ``cmakeMinimumRequired`` @@ -82,6 +98,12 @@ The root object recognizes the following fields: An optional array of `Test Preset`_ objects. This is allowed in preset files specifying version ``2`` or above. +``include`` + + An optional array of strings representing files to include. If the filenames + are not absolute, they are considered relative to the current file. + This is allowed in preset files specifying version ``4`` or above. + Configure Preset ^^^^^^^^^^^^^^^^ diff --git a/Help/manual/presets/example.json b/Help/manual/presets/example.json index b08445a..a7ec10e 100644 --- a/Help/manual/presets/example.json +++ b/Help/manual/presets/example.json @@ -1,5 +1,5 @@ { - "version": 3, + "version": 4, "cmakeMinimumRequired": { "major": 3, "minor": 21, diff --git a/Help/manual/presets/schema.json b/Help/manual/presets/schema.json index 7852550..327291d 100644 --- a/Help/manual/presets/schema.json +++ b/Help/manual/presets/schema.json @@ -42,6 +42,21 @@ "testPresets": { "$ref": "#/definitions/testPresetsV3"} }, "additionalProperties": false + }, + { + "properties": { + "version": { + "const": 4, + "description": "A required integer representing the version of the JSON schema." + }, + "cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired"}, + "vendor": { "$ref": "#/definitions/vendor" }, + "configurePresets": { "$ref": "#/definitions/configurePresetsV3"}, + "buildPresets": { "$ref": "#/definitions/buildPresetsV3"}, + "testPresets": { "$ref": "#/definitions/testPresetsV3"}, + "include": { "$ref": "#/definitions/include"} + }, + "additionalProperties": false } ], "required": [ @@ -1235,6 +1250,13 @@ "description": "Null indicates that the condition always evaluates to true and is not inherited." } ] + }, + "include": { + "type": "array", + "description": "An optional array of strings representing files to include. If the filenames are not absolute, they are considered relative to the current file.", + "items": { + "type": "string" + } } } } diff --git a/Help/release/dev/cmake-presets-include.rst b/Help/release/dev/cmake-presets-include.rst new file mode 100644 index 0000000..51219bd --- /dev/null +++ b/Help/release/dev/cmake-presets-include.rst @@ -0,0 +1,6 @@ +cmake-presets-include +--------------------- + +* :manual:`cmake-presets(7)` files now support schema version ``4``. +* :manual:`cmake-presets(7)` files now have an optional ``include`` field, + which allows the files to include other files. |