mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 14:48:19 -05:00
Merge topic 'cmake-presets-include'
26a5512c0fCMakePresets: Add include fielda239f23a98Refactor: Generalize file graph in CMakePresets84d440caacRefactor: Split JSON processing into configure, build, and test presetsfd6ea2f67fRefactor: Rename cmCMakePresetsFile to cmCMakePresetsGraph Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !6829
This commit is contained in:
@@ -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
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": 3,
|
||||
"version": 4,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 21,
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user