diff options
Diffstat (limited to 'Help')
-rw-r--r-- | Help/command/add_custom_command.rst | 45 | ||||
-rw-r--r-- | Help/guide/ide-integration/index.rst | 6 | ||||
-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 |
6 files changed, 102 insertions, 7 deletions
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index b45a079..f07b4a6 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -271,9 +271,48 @@ The options are: ``DEPFILE`` .. versionadded:: 3.7 - Specify a ``.d`` depfile which holds dependencies for the custom command. - It is usually emitted by the custom command itself. This keyword may only - be used if the generator supports it, as detailed below. + Specify a depfile which holds dependencies for the custom command. It is + usually emitted by the custom command itself. This keyword may only be used + if the generator supports it, as detailed below. + + The expected format, compatible with what is generated by ``gcc`` with the + option ``-M``, is independent of the generator or platform. + + The formal syntax, as specified using + `BNF <https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form>`_ notation with + the regular extensions, is the following: + + .. raw:: latex + + \begin{small} + + .. productionlist:: depfile + depfile: `rule`* + rule: `targets` (`colon` `dependencies`?)? `eol` + colon: `separator`* ':' space `separator`* + targets: `target` (`separator` `target`)* + target: `pathname` + dependencies: `dependency` (`separator` `dependency`)* + dependency: `pathname` + separator: (space | line_continue)+ + line_continue: '\' `eol` + space: ' ' | '\t' + pathname: `character`+ + character: `std_character` | `dollar` | `hash` | `whitespace` + std_character: <any character except '$', '#' or ' '> + dollar: '$$' + hash: '\#' + whitespace: '\ ' + eol: '\r'? '\n' + + .. raw:: latex + + \end{small} + + .. note:: + + As part of ``pathname``, any slash and backslash is interpreted as + a directory separator. .. versionadded:: 3.7 The :generator:`Ninja` generator supports ``DEPFILE`` since the keyword diff --git a/Help/guide/ide-integration/index.rst b/Help/guide/ide-integration/index.rst index 779883b..0d818c2 100644 --- a/Help/guide/ide-integration/index.rst +++ b/Help/guide/ide-integration/index.rst @@ -65,6 +65,12 @@ run: cmake -S /path/to/source -B /path/to/source/build -G Ninja +In cases where a preset contains lots of cache variables, and passing all of +them as ``-D`` flags would cause the command line length limit of the platform +to be exceeded, the IDE should instead construct a temporary cache script and +pass it with the ``-C`` flag. See :ref:`CMake Options` for details on how the +``-C`` flag is used. + While reading, parsing, and evaluating the contents of ``CMakePresets.json`` is straightforward, it is not trivial. In addition to the documentation, IDE vendors may also wish to refer to the CMake source code and test cases for a 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. |