A Python-based linter that checks CMake files for coding style issues and enforces consistent formatting.
cmakelint is a command-line linter that analyzes CMake files for style and consistency issues. It helps developers maintain clean CMake code by detecting problems like line length violations, improper indentation, inconsistent naming, and whitespace errors. The tool is designed to integrate into development workflows and CI pipelines to enforce CMake coding standards automatically.
CMake users, build system engineers, and development teams who want to enforce consistent style in their CMake projects. It is especially valuable for projects with multiple contributors or those adopting CI/CD practices.
Developers choose cmakelint because it is a lightweight, Python-based tool specifically tailored for CMake, with configurable rules and support for inline pragmas. It provides clear, actionable feedback and integrates easily into existing workflows without complex dependencies.
Check for coding style issues in CMake files
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows enabling or disabling specific checks via command-line flags or a .cmakelintrc file, as shown in the README with filter examples like '-whitespace/indent'.
Returns exit codes 0, 1, and 32 for easy integration into scripts and continuous integration pipelines, ensuring build breaks on style violations.
Supports # lint_cmake: pragma comments within CMake files to override filters locally, providing fine-grained control over linting without global config changes.
Requires only Python and works on any system, with support for both traditional and XDG config file locations, making deployment straightforward.
Only reports style violations without offering automated corrections, forcing developers to manually fix each issue, which can be time-consuming for large codebases.
Configuration files currently only support the 'filter=' option, lacking customization for rule severity, output formats, or other advanced settings like custom rule definitions.
Primarily focuses on style and syntax checks like whitespace and line length, with no support for advanced CMake-specific errors such as improper target dependencies or cache variable misuse.