summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorChenMoFeiJin <1424865872@qq.com>2023-09-07 12:04:02 (GMT)
committerChenMoFeiJin <1424865872@qq.com>2023-09-12 10:18:37 (GMT)
commitf1a717952020401502a109de7af211130251a067 (patch)
tree9b0503da4aa0fc58209c717169b4827ac749ff27 /Help
parentf83771dfceb9d800d17955219b33e50eb155cc04 (diff)
downloadCMake-f1a717952020401502a109de7af211130251a067.zip
CMake-f1a717952020401502a109de7af211130251a067.tar.gz
CMake-f1a717952020401502a109de7af211130251a067.tar.bz2
presets: Add $schema property to JSON schema
Many modern code editors have support for JSON Schema. When you specify the `$schema` property in a JSON file, the editor can provide features like auto-completion, error checking, etc., which can improve your efficiency when writing and modifying the `CMakePresets.json` file.
Diffstat (limited to 'Help')
-rw-r--r--Help/manual/cmake-presets.7.rst9
-rw-r--r--Help/manual/presets/schema.json23
-rw-r--r--Help/release/dev/presets-schema.rst5
3 files changed, 37 insertions, 0 deletions
diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst
index e2366da..46b5fc7 100644
--- a/Help/manual/cmake-presets.7.rst
+++ b/Help/manual/cmake-presets.7.rst
@@ -41,6 +41,15 @@ The files are a JSON document with an object as the root:
The root object recognizes the following fields:
+``$schema``
+ An optional string that provides a URI to the JSON schema that describes the
+ structure of this JSON document. This field is used for validation and
+ autocompletion in editors that support JSON schema. It doesn't affect the
+ behavior of the document itself. If this field is not specified, the JSON
+ document will still be valid, but tools that use JSON schema for validation
+ and autocompletion may not function correctly.
+ This is allowed in preset files specifying version ``8`` or above.
+
``version``
A required integer representing the version of the JSON schema.
The supported versions are:
diff --git a/Help/manual/presets/schema.json b/Help/manual/presets/schema.json
index 71db769..d27faa1 100644
--- a/Help/manual/presets/schema.json
+++ b/Help/manual/presets/schema.json
@@ -106,12 +106,35 @@
"include": { "$ref": "#/definitions/include" }
},
"additionalProperties": false
+ },
+ {
+ "properties": {
+ "$schema": { "$ref": "#/definitions/$schema" },
+ "version": {
+ "const": 8,
+ "description": "A required integer representing the version of the JSON schema."
+ },
+ "cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired" },
+ "vendor": { "$ref": "#/definitions/vendor" },
+ "configurePresets": { "$ref": "#/definitions/configurePresetsV7" },
+ "buildPresets": { "$ref": "#/definitions/buildPresetsV4" },
+ "testPresets": { "$ref": "#/definitions/testPresetsV6" },
+ "packagePresets": { "$ref": "#/definitions/packagePresetsV6" },
+ "workflowPresets": { "$ref": "#/definitions/workflowPresetsV6" },
+ "include": { "$ref": "#/definitions/include" }
+ },
+ "additionalProperties": false
}
],
"required": [
"version"
],
"definitions": {
+ "$schema": {
+ "type": "string",
+ "description": "The schema against which to verify this document.",
+ "format": "uri-reference"
+ },
"cmakeMinimumRequired": {
"type": "object",
"description": "An optional object representing the minimum version of CMake needed to build this project.",
diff --git a/Help/release/dev/presets-schema.rst b/Help/release/dev/presets-schema.rst
new file mode 100644
index 0000000..964373c
--- /dev/null
+++ b/Help/release/dev/presets-schema.rst
@@ -0,0 +1,5 @@
+presets-schema
+--------------
+
+* :manual:`cmake-presets(7)` files now support schema version ``8``.
+ It adds support for a ``$schema`` field.