Skip to main content

A fast, correct CMake formatter

Project description

cmakefmt banner

cmakefmt

CI
CI Pages Coverage CodSpeed

Package
Crates.io dependency status

Security & Quality
REUSE status OpenSSF Scorecard OpenSSF Best Practices

A fast, correct CMake formatter — cmake-format, reimagined in Rust.

cmakefmt demo

Contents

Why cmakefmt?

  • Drop-in replacement for cmake-format. A single native binary with the same workflows and no Python environment to manage.
  • 100× faster. Geometric-mean speedup over cmake-format across a corpus of 14 large open-source repositories (see Performance).
  • Workflow-first design. --check, --diff, --staged, --changed, semantic verification, JSON/SARIF/JUnit reports, an LSP server, and a GitHub Action are all first-class features rather than scripted afterthoughts.

Install

brew install cmakefmt/cmakefmt/cmakefmt   # macOS / Linux (Homebrew)
pip install cmakefmt                      # any platform with Python
cargo install cmakefmt-rust               # any platform
winget install cmakefmt.cmakefmt          # Windows

Conda, Docker, pre-built binaries, and full setup notes are documented at Installation.

Quick start

cmakefmt --in-place .   # format every CMake file in the project

The full CLI reference, configuration schema, editor integrations, and migration guide from cmake-format all live at cmakefmt.dev.

GitHub Action

The official cmakefmt-action wraps the binary for use in CI workflows:

- uses: actions/checkout@v6
- uses: cmakefmt/cmakefmt-action@v2

That snippet is the strict whole-repo check: it fails the job and emits inline PR annotations for any file that would change under formatting. The action also supports other modes and file-selection scopes:

- uses: cmakefmt/cmakefmt-action@v2
  with:
    mode: diff       # check, diff, fix, or setup
    scope: changed   # all, changed, or staged

For the complete list of inputs and recommended rollout patterns, see the cmakefmt-action README.

Documentation

The full documentation lives at cmakefmt.dev.

Page Description
Getting Started First format in under a minute
Installation Every install channel and setup notes
CLI Reference Every flag, subcommand, exit code
Config Reference Full config schema with examples
Migration from cmake-format Incremental rollout guide
Editor Integration VS Code, Neovim, Helix, Zed, Emacs
Comparison vs cmake-format and gersemi
Performance Benchmark methodology and numbers
Library API Embed cmakefmt in Rust code
Troubleshooting Common issues and debug workflow
Playground Try cmakefmt in your browser
Contributing / Changelog How to help; what changed

Status

cmakefmt is stable and actively maintained. The built-in command spec is audited against CMake 4.3.1. The release contract and per-channel support levels are documented at Release.

License

cmakefmt is dual-licensed under MIT or Apache-2.0, at your option.


This project is independent from other Rust crates of the same name — it is not affiliated with azais-corentin/cmakefmt or yamadapc/cmakefmt.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmakefmt-1.6.0.tar.gz (170.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cmakefmt-1.6.0-py3-none-win_amd64.whl (2.8 MB view details)

Uploaded Python 3Windows x86-64

cmakefmt-1.6.0-py3-none-manylinux_2_28_x86_64.whl (2.7 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

cmakefmt-1.6.0-py3-none-manylinux_2_28_aarch64.whl (2.5 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

cmakefmt-1.6.0-py3-none-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

cmakefmt-1.6.0-py3-none-macosx_10_12_x86_64.whl (2.6 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file cmakefmt-1.6.0.tar.gz.

File metadata

  • Download URL: cmakefmt-1.6.0.tar.gz
  • Upload date:
  • Size: 170.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cmakefmt-1.6.0.tar.gz
Algorithm Hash digest
SHA256 43830cc258d7449b1c6317cb81722e0e41d3955feb1e8f885ff471d913c21387
MD5 a1e04110e0c73979059a9ef33470b86f
BLAKE2b-256 ef1c88e6712f70ca6ea964687fabf571468199ddfa6d95b4039f6f4b2d0d3ba2

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmakefmt-1.6.0.tar.gz:

Publisher: release.yml on cmakefmt/cmakefmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cmakefmt-1.6.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: cmakefmt-1.6.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cmakefmt-1.6.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 176dd4b85fbcbbb51f396502c4331f13551b154d275122c1d5126918b098e0f8
MD5 8bf6d25a2816ac5f5dbe5bdf6f9788d5
BLAKE2b-256 6fb7c65db07d46aa73794521e6eae3e5ece2e5fa68af7cb999d5787336569e10

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmakefmt-1.6.0-py3-none-win_amd64.whl:

Publisher: release.yml on cmakefmt/cmakefmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cmakefmt-1.6.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cmakefmt-1.6.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1ec0932fd69cba905bbcec61e8493deced7ea6e0c791db38200527dbe67daeb8
MD5 47d7dac6be0e6927cecf232f55f4e7b3
BLAKE2b-256 cc6647ab554db4dd0c92928a74add6e800a79d4274ff6ecca74c2f2306efce94

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmakefmt-1.6.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release.yml on cmakefmt/cmakefmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cmakefmt-1.6.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cmakefmt-1.6.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a08c873de419937c0bb78883489851e7e994cc174f6caa50af2122194f152c13
MD5 870c4700b51e0beb1edf1e15bc3bc38b
BLAKE2b-256 1aa7143f00905cf727452faae7d1d8dce0dc767923602d41051f730e75c0ddef

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmakefmt-1.6.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: release.yml on cmakefmt/cmakefmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cmakefmt-1.6.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cmakefmt-1.6.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e21afe7c1073d6cc1201a65e7fa07f8cd163937c7bebe6a17f1d6140d8eb89e
MD5 2c611e827dfdb920a82198938f5d57a1
BLAKE2b-256 c41ca1b6525df3eed0ff9597bf70ef6114634f552de88bfbe41295c4d3414de6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmakefmt-1.6.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on cmakefmt/cmakefmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cmakefmt-1.6.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cmakefmt-1.6.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 43241d1f4586224e76f112af113141d9c475e5faf2edbc96a6cb16bd77d55966
MD5 be4b641ba9400f9b2a4421238a59ef85
BLAKE2b-256 30f9be0a85ff753e98b4a4ffd0ea6d0a5799791467629e27c4260b5a50f7097f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cmakefmt-1.6.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on cmakefmt/cmakefmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page