gersemi is a specialized source code formatting utility designed to maintain consistent styling across CMake project files. Written in Python, it automatically restructures CMake commands, arguments, indentation, and multiline expressions. Developers can customize formatting preferences through command-line arguments or hierarchical configuration files. The application recognizes custom CMake functions and macros when their definitions are supplied. Configurable argument expansion strategies determine how lengthy command expressions are arranged. Parallel processing and file caching improve formatting efficiency across large projects. The utility provides formatting verification, difference previews, optional sanity checks, and pre-commit integration for automated development workflows.
Features
- Automatic CMake source code formatting with consistent indentation and command structure
- Configurable line lengths, indentation styles, and multiline argument expansion strategies
- Hierarchical configuration files with command-line preference overrides
- Custom CMake function and macro recognition through supplied command definitions
- Parallel file processing and caching for improved formatting performance
- Formatting verification, colorized difference previews, and pre-commit hook integration