summaryrefslogtreecommitdiffstats
path: root/Help/manual
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-12-22 21:49:38 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-01-07 00:46:41 (GMT)
commit26a5512c0f952333f089a08b0df84e3efa7fb063 (patch)
treee37cf58a76b5110913fe9d5f380e9aafb7717872 /Help/manual
parenta239f23a987a063852c8f29040ef4eaeaebf3b9c (diff)
downloadCMake-26a5512c0f952333f089a08b0df84e3efa7fb063.zip
CMake-26a5512c0f952333f089a08b0df84e3efa7fb063.tar.gz
CMake-26a5512c0f952333f089a08b0df84e3efa7fb063.tar.bz2
CMakePresets: Add include field
Fixes: #21331
Diffstat (limited to 'Help/manual')
-rw-r--r--Help/manual/cmake-presets.7.rst28
-rw-r--r--Help/manual/presets/example.json2
-rw-r--r--Help/manual/presets/schema.json22
3 files changed, 48 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"
+ }
}
}
}