Repository navigation
Conversation
CMake was read only as a build system: its flags, targets and presets fed the C and C++ checks, but the CMake code itself (CMakeLists.txt, *.cmake) was asked nothing, so fmt's and cmake_template's CMake formatting jobs were invisible, and a project that never formats or lints its CMake was not told. CMake code is now a format of its own (a CMake profile), recognised by `CMakeLists.txt` and `*.cmake` and judged beside the language it builds, as Dockerfiles are: - code-formatting: gersemi (`--check`, `--diff`; `.gersemirc`) or cmake-format (`--check`; `.cmake-format.yaml` and its other names); `-i` alone enforces nothing, and their pre-commit hooks count where CI runs them; - static-analysis: cmake-lint (cmakelang) or cmakelint (`.cmakelintrc`). The C profile no longer accounts for `.cmake` files itself. Every CMake project now has a CMake place in those two checks. The tests of the C and C++ checks are about their languages: a layout's results leave out the formats its own files bring (a CMake layout's CMakeLists.txt), as the layout model already says. The C, C++ and Fortran well-configured fixtures format and lint their CMake; fmt and cmake_template stand for CMake in the corpus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #378 +/- ##
=======================================
Coverage 99.53% 99.53%
=======================================
Files 318 319 +1
Lines 20953 20969 +16
Branches 2509 2509
=======================================
+ Hits 20856 20872 +16
Misses 97 97 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ror=dev
CMake's warnings about the project's own code (deprecated commands, policy warnings meant for
the project) should fail CI, as a compiler's do. CMake code now has a warnings-as-errors
practice: the `cmake` that configures the build has `-Werror=dev`, or the configure preset in
CMakePresets.json says `"errors": {"dev": true}`. Without either it fails.
The C, C++ and CMake well-configured fixtures configure with -Werror=dev, and the Fortran one
has a preset that does; the per-language flags tests of C and C++ leave out the CMake place,
which is the format's, not a language's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CMake code (
CMakeLists.txt,*.cmake) is now judged: formatted and linted, as a format of its own beside the language it builds.Until now, CMake was read only as a build system. Its flags, targets, presets and build types fed the C and C++ checks, but the CMake code itself was asked nothing. So fmt's cmake-format job was invisible, and a project that never formats or lints its CMake wasn't told.
What is judged
A new CMake profile, a format (as Docker's is):
CMakeLists.txtand*.cmake. The C profile no longer accounts for.cmakefiles itself.--checkor--diff, with its style in.gersemirc;--check, with its style in.cmake-format.yaml(or.cmake-format,.yml,.json,.py);-ialone enforces nothing, unless a later step fails on the diff;.cmakelintrc).cmake -Werror=devon a configure line in CI, or a configure preset's"errors": {"dev": true}inCMakePresets.json. Without either, it FAILs. This is deliberately strict for now and can be revisited.eng/common/cross/toolchain.cmake) is auxiliary under A language present only in auxiliary files (fixtures, tooling, docs assets, editor dotfiles) becomes a product ecosystem and its FAILs decide the project #182, so it warns.Reading CMake as the C/C++ build system is unchanged.
Tests
CMakeLists.txt. The layout model already describes a layout's formats as "those the layout is about".gersemi --checkandcmake-lint. The C and C++ ones configure with-Werror=dev, and the Fortran one uses a preset with"errors": {"dev": true}. New bare and well-configured CMake fixtures, a layout, and a docs page are added.Corpus
19 of the 235 projects have CMake code:
.cmake-format.yamlthat CI never runs.Formatting and linting change only two overall statuses, because those projects already failed these checks for other reasons.
No corpus project configures with
-Werror=dev. So warnings-as-errors now FAILs for five projects whose C/C++ warnings had been enough: cmake_template and glfw (from PASS), and fmt, googletest and uber/h3 (from WARN). The other CMake projects already failed it. No other check changes.Gates
pytest, ruff, ruff format, mypy, lizard, coverage, jscpd and strict self-validation: all pass.
🤖 Generated with Claude Code
https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt