Gersemi is a Python-based command-line formatter for CMake code, designed to make your CMakeLists.txt files and `.cmake` modules consistent and readable. It leverages a custom handwritten parser in Rust for robust and efficient formatting. The current version is 0.27.2, with frequent releases addressing bug fixes and introducing new features.
pip install gersemiNo compatibility data collected yet for this library.
This quickstart demonstrates how to use `gersemi` to format a CMake file. It creates a temporary `CMakeLists.txt`, formats it using the `gersemi format` command-line tool, and prints the original and formatted content.
If you rely on the previous 'safe' formatting behavior, explicitly add `--safe` to your `gersemi` command (e.g., `gersemi format --safe <file>`) or configure `unsafe: false` in your `.gersemirc.toml`.
Carefully review formatting changes after upgrading to 0.27.0 or newer, especially for intricate CMake scripts, to ensure the output aligns with expectations. Consider using `git diff` for large codebases.
Update your custom `gersemi` extensions to include the mandatory `signature` keyword in their definition according to the new API specification.
Ensure your `.pre-commit-config.yaml` points to `repo: https://github.com/BlankSpruce/pre-commit-gersemi` for the `gersemi` hook.
Install the `gersemi` package using pip: `pip install gersemi`. Ensure your Python environment's script directory is in your PATH.
To revert to the previous, less aggressive 'safe' formatting, run `gersemi format --safe <files...>` or configure `unsafe: false` in your `.gersemirc.toml`.
Verify your `.pre-commit-config.yaml` points to the correct repository for `gersemi`: `repo: https://github.com/BlankSpruce/pre-commit-gersemi`. Also, ensure `gersemi` is installed in your pre-commit environment by running `pre-commit install-hooks`.
No dependency data recorded yet.