23 Commits
Author SHA1 Message Date
Matthew Woehlke 618c074a8c Diagnostics: Use categories for presets
Modify diagnostics to track which preset schema version corresponds to
the introduction of each diagnostic. Modify how we parse presets to use
the set of diagnostics to generate bindings, and to store diagnostics as
maps rather than as fixed members. Enforce that only diagnostics known
to the specified preset version are present.

This is a first and necessary step toward moving CMake's internals over
to flexible categories rather than each category having its own bespoke
variables and member functions.

Note that the presets documentation currently contains some broken
links, as it is anticipating further documentation updates that will
happen in a future commit.
2026-04-13 10:41:18 -04:00
Brad King 8832f78dd6 IWYU: Update for Debian 13 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 13.  Some patterns:

* Types named in virtual `override` signatures no longer require
  includes since the overridden signature already names them.

* A function argument's type needs to be included even if its constructor
  is called only by implicit conversion.  For example, constructing a
  `std::function` from a lambda now requires `<functional>`.

* Some prior mysterious `<type_traits>` inclusions are no longer required.
2025-11-12 14:54:35 -05:00
Daniel Pfeifer 0c4040057a source: Pass cm::string_view by value 2025-07-30 11:55:33 -04:00
Kitware Robot 1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Kitware Robot 0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05:00
Alex Turbov 0c17cc9ef5 cmJSONHelpers.h: Add FilteredObject helper
Iterate over the object's members and call a filter callable to decide what
to do with the current key/value. A filter returns one of the `FilterResult`
values. A container type is an associative or a sequence container of pairs
(key, value).

Refactor `MapFilter()` and `Map()` to use `FilteredObject()`. Moreover,
for C++ >= 17 implementation is more optimized depending on the given filter
object type and capable of detecting and properly calling the filter callable
using 1 or 3 arguments, up to totally eliminate any checking (even dummy)
in the generated code.

Supported container types, used to append key/value items, aren't limited to
`std::map` only and can be any associative container or a sequenced one with
pairs of key/value as elements.
2024-08-26 19:01:48 +04:00
Alex Turbov 17de44e99b cmJSONHelpers.h: Add some empty lines to split code blocks 2024-08-15 22:01:34 +04:00
Alex TurbovandMartin Duffy 0b334e5bfb cmJSONHelpers.h: Add generic predicate checking helper
And use it in the `cmCMakePresetsGraphReadJSON.cxx` to check
presets schema version in the declarative way.

Co-authored-by: Martin Duffy <martin.duffy@kitware.com>
2024-08-15 22:01:34 +04:00
Alex Turbov 503a73b183 cmJSONHelpers.h: Use map::emplace() instead of operator[] 2024-08-14 01:37:38 +04:00
Alex Turbov e7dcd51a61 cmJSONHelpers.h: Remove useless cmStrCat() call 2024-08-14 01:37:38 +04:00
Alex Turbov 5096ea7a92 cmJSONHelpers.h: Optimize of adding Members to a vector 2024-08-14 01:37:38 +04:00
Alex Turbov f4a2070731 cmJSONHelpers.h: Remove redundant ; 2024-08-14 01:16:40 +04:00
Alex Turbov 23be530275 cmJSONHelpers.h: Move variable declaation close to first usage 2024-08-14 01:16:34 +04:00
Aliaksandr AverchankaandKanaiym 7d2cc6ece6 presets: Allow comments in presets files
Co-authored-by: Kanaiym <abdigak@clarkson.edu>
Fixes: #22791
2024-06-24 15:42:46 -04:00
Kyle Edwards 94241e243d cmJSONHelpers: Make error generators proper functions 2023-08-16 09:56:48 -04:00
Kyle Edwards 93ed53790c bootstrap: Unconditionally build libjsoncpp 2023-07-26 10:07:38 -04:00
Martin Duffy 19305afd8a presets: Improve JSON parser and error messages 2023-03-29 10:41:19 -04:00
Kitware Robot 33abef7416 Revise C++ coding style using clang-format-15
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 15.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Fixes: #24315
2023-01-18 16:20:47 -05:00
Martin Duffy 7b7fc2df0b cmJSONHelpers: Allow passing state context
Allow for passing of context to JSON Helper methods in cmJSONHelpers.
2022-05-05 12:12:53 -04:00
Martin Duffy 30336dab66 cmJSONHelpers: Restructure cmJSONHelpers
Restructure cmJSONHelpers to prevent SunPro errors when passing context.
2022-05-05 12:12:12 -04:00
Kyle Edwards 8bc5c8961e CMakePresets.json: Add the ability to conditionally disable presets 2021-03-22 15:04:54 -04:00
Kyle Edwards 3059e6aed7 cmJSONHelpers: Add new Bind() function 2020-10-05 09:49:59 -04:00
Kyle Edwards 3f3a30e1e0 JSON: Add helpers 2020-09-09 08:29:02 -04:00