For pre-commit: see https://github.com/pre-commit/pre-commit
For cmake_format: see https://github.com/cheshirekow/cmake_format
Add this to your .pre-commit-config.yaml:
- repo: https://github.com/aharrison24/cmake-format-pre-commit.git
rev: 'v0.5.5' # Use the sha / tag you want to point at
hooks:
- id: cmake-format
args: [--in-place]
pre-commit uses a python library called identify to detect cmake files on which to run cmake_lint. CMake support was added to identify in version 1.4.6, so it's important you have at least that. You can do that from pip with a command like:
pip3 install "identify>=1.4.6"When a new version of cmake_format is released, this repo needs a new commit
with a corresponding tag. This is done with the bumpversion app, which is
easily obtained through pip:
pip3 install bumpversionGenerate a new commit and tag by calling bumpversion like this:
bumpversion --new-version 0.5.5 major