cmake_check v0.2.0
cmake_check
Cmake_check is a linter for the CMake language. It takes a set of user-defined rules and reports violations for CMakeLists.txt files and CMake modules.
- Quick Start
- Overview
- Download
- Versioning
- Basic Usage
- How it Works
- Limitations
- Features Currently in Development
Quick Start ▲
Step 1: Download cmake_check (several methods, see below).
Step 2: Open a terminal (cmd.exe
on Windows).
Step 3: Invoke cmake_check to check your CMake files or directories.
The executable name differs depending on whether you use the
development source version (cmake_check
), a Windows executable
(cake_check-win.exe
) or , a Linux executable
(cmake-check-linux
). On this page, cmake_check
is the generic term
used to refer to any of these.
a file
a directory
Overview ▲
Cmake_check is a linter for the CMake language. It takes a set of user-defined rules and reports violations for CMakeLists.txt files and CMake modules. CMake_check is a command line application suitable for continuous integration checks. This is especially useful for large source trees with hundreds of CMake files. Cmake_check can be used to enforce a certain coding style or project/company guidelines. It is written in TypeScript and runs on every platform where node.js is available.
Features are:
- recursive check of all CMake files in a given directory
- allows combination of checks to form custom rules
- a rule may consist of any number of checks
- provides warning output (msbuild format) that can be used by the jenkins warnings plugin
Available checks:
- require commands to exist (or not exist)
- allow white-listed commands only (to limit the use of custom functions)
Planned checks:
- require a specific command order
- constraints on specific command arguments
- constraints on paths (e.g. no ..)
- comment checks
- maximum line length
- indentation checks
Binaries ▲
Each release comes with a set of Linux and Windows binaries.
NPM ▲
Install NodeJS (version > 8.11).
npm install -g cmake_check`
Versioning ▲
Cmake_check uses semantic versioning.
Basic Usage ▲
The basic use is:
cmake_check -c <config file> -i <input folder or file>
All CMake files in the given input folders are analyzed with the given configuration. All warnings are written to stdout.
For more information and further available options call cmake_check -h
.
Configuration ▲
An example configuration is available. It describes some of the modern CMake rules.
Documentation for all config options is under construction.
How It Works ▲
Cmake_check uses a parser-generator and a grammar to create a parser of the CMake language. All CMakeLists.txt files from input are parsed to a structured object. All configured checks are executed on that object. Failed checks are printed as warnings.
Limitations
- the language parser will fail on CMakeLists.txt files that do not conform to the CMake language
- these errors are reported by CMake itself, a successful run of CMake on the input files is a precondition for cmake_check
Features under development ▲
See the development board for issues that are in work.