Draft: Cmake lint
This merge request enables the use of pre-commit run --all-files
for checking our CMake build system for inconsistencies.
Pre-commit can be installed via: https://pre-commit.com/#install
Example output on a recent state of cdi:
cmake-format.............................................................Failed
- hook id: cmake-format
- files were modified by this hook
cmake-lint...............................................................Failed
- hook id: cmake-lint
- exit code: 1
app/CMakeLists.txt
==================
CMakeLists.txt
==============
cmake/FindNetCDF.cmake
======================
cmake/FindNetCDF.cmake:12,00: [C0111] Missing docstring on function or macro declaration
cmake/FindNetCDF.cmake:12,09: [C0103] Invalid function name "FindNetCDF_get_is_parallel_aware" doesn't match `[0-9a-z_]+`
cmake/FindNetCDF.cmake:25,08: [C0103] Invalid PARENT_SCOPE variable name "NetCDF_HAS_PARALLEL" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+|[a-z][a-z0-9_]+`
cmake/FindNetCDF.cmake:30,08: [C0103] Invalid PARENT_SCOPE variable name "NetCDF_HAS_PARALLEL" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+|[a-z][a-z0-9_]+`
cmake/FindNetCDF.cmake:41,06: [C0103] Invalid directory variable name "NetCDF_FOUND" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
cmake/FindNetCDF.cmake:42,06: [C0103] Invalid directory variable name "NetCDF_INCLUDE_DIRS" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
cmake/FindNetCDF.cmake:43,06: [C0103] Invalid directory variable name "NetCDF_LIBRARIES" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
cmake/FindNetCDF.cmake:44,06: [C0103] Invalid directory variable name "NetCDF_VERSION" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
cmake/FindNetCDF.cmake:82,08: [C0103] Invalid directory variable name "NetCDF_FOUND" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
cmake/FindNetCDF.cmake:83,08: [C0103] Invalid directory variable name "NetCDF_INCLUDE_DIRS" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
cmake/FindNetCDF.cmake:84,08: [C0103] Invalid directory variable name "NetCDF_LIBRARIES" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
cmake/FindNetCDF.cmake:85,08: [C0103] Invalid directory variable name "NetCDF_VERSION" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
cmake/FindNetCDF.cmake:158,06: [C0103] Invalid directory variable name "NetCDF_VERSION" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
cmake/FindNetCDF.cmake:178,06: [C0103] Invalid directory variable name "NetCDF_INCLUDE_DIRS" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
cmake/FindNetCDF.cmake:179,06: [C0103] Invalid directory variable name "NetCDF_LIBRARIES" doesn't match `[A-Z][0-9A-Z_]+|_[0-9a-z_]+`
src/CMakeLists.txt
==================
Summary
=======
files scanned: 4
found lint:
Convention: 15
tests/CMakeLists.txt
====================
Summary
=======
files scanned: 1
found lint: