monado/scripts/format-cmake.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
762 B
Bash
Raw Normal View History

2022-05-25 14:57:29 +00:00
#!/bin/sh
2024-03-21 15:43:44 +00:00
# Copyright 2019-2024, Collabora, Ltd.
2022-05-25 14:57:29 +00:00
# SPDX-License-Identifier: BSL-1.0
2023-11-15 17:09:51 +00:00
# Author: Rylie Pavlik <rylie.pavlik@collabora.com>
2022-05-25 14:57:29 +00:00
# Formats all the CMake files in this project
set -e
CMAKE_FORMAT=cmake-format
if ! command -v ${CMAKE_FORMAT} > /dev/null; then
2024-03-21 15:43:44 +00:00
echo "cmake-format not found, do pipx install cmakelang" 1>&2
2022-05-25 14:57:29 +00:00
exit 1
fi
(
echo "${CMAKE_FORMAT}"
"${CMAKE_FORMAT}" -v
cd "$(dirname $0)/.."
find \
CMakeLists.txt \
doc \
src/xrt \
src/external/CMakeLists.txt \
src/CMakeLists.txt \
tests \
\( -name "CMakeLists.txt" -o -name "*.cmake" \) \
! -name ".cmake" \
2022-05-25 14:57:29 +00:00
-print0 | \
xargs -0 "${CMAKE_FORMAT}" -c "$(pwd)/.cmake-format.py" -i
)