Skip to content
@cmakefmt

cmakefmt

cmakefmt

cmakefmt is a fast, correct CMake formatter built in Rust.

It replaces the aging Python cmake-format tool with a single native binary that is easy to install, fast enough for pre-commit and CI, and capable enough for real project use.

Repositories

Repository Description
cmakefmt/cmakefmt Main formatter — CLI, LSP server, library
cmakefmt/vscode-cmakefmt VS Code extension
cmakefmt/cmakefmt-action GitHub Action
cmakefmt/homebrew-cmakefmt Homebrew tap

Install

brew install cmakefmt/cmakefmt/cmakefmt   # macOS
pip install cmakefmt                      # any platform with Python
cargo install cmakefmt-rust               # any platform
conda install -c conda-forge cmakefmt     # conda-forge

Or download a pre-built binary from GitHub Releases.

Also available on winget, the VS Code Marketplace, Open VSX Registry, and as a Docker image.

Why cmakefmt?

  • Fast — 104× faster than cmake-format (geo-mean across 11 real-world fixtures); fast enough for editor-on-save, pre-commit hooks, and CI
  • One binary — no Python environment to manage
  • LSP servercmakefmt lsp provides format-on-save in any editor
  • Workflow-first--check, --diff, --staged, --changed, machine-readable reports, and config introspection
  • Custom command aware — project-specific macros and functions format sensibly
  • Comments preserved — barrier regions, fence blocks, and pragma support

Quick Start

cmakefmt config init               # generate a starter .cmakefmt.yaml
cmakefmt .                         # preview formatted output
cmakefmt --diff .                  # view a unified diff of what would change
cmakefmt --in-place .              # apply formatting across the whole project
cmakefmt --staged --check          # use in pre-commit hooks
cmakefmt --path-regex 'src/.*' .   # format CMake files only under src/

Documentation

Contributing

Issues, bug reports, and pull requests are welcome in cmakefmt/cmakefmt.

Pinned Loading

  1. cmakefmt cmakefmt Public

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

    Rust 16

  2. cmakefmt-action cmakefmt-action Public

    A lightning-fast CMake file formatter powered by cmakefmt.

    TypeScript

  3. vscode-cmakefmt vscode-cmakefmt Public

    A VS Code extension for cmakefmt

    TypeScript 1

  4. homebrew-cmakefmt homebrew-cmakefmt Public

    This tap for the official Homebrew formula for cmakefmt

    Ruby

Repositories

Showing 6 of 6 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…