Reformat CMake: Ensure `cmake-format` works
@@ -10,17 +10,25 @@ SCRIPTS_DIR=$(dirname "$0")
CMAKE_FORMAT=$(which cmake-format)
+cd "$SOURCE"
+
if [ -z "${CMAKE_FORMAT}" ]; then
echo 'Please install `cmake-format`'
exit 0
fi
+output=$(2>&1 "${CMAKE_FORMAT}" CMakeLists.txt)
+
+if [ $? != 0 ]; then
+ 2>&1 printf 'It seems your local installation of `cmake-format` is broken:\n\n%s' "$output"
+ exit 0
+fi
+
if [ -z "$(which sponge)" ]; then
echo 'Please install `sponge`'
exit 0
fi
-cd "$SOURCE"
for file in $(find . \( -name 'CMakeLists.txt' -or -name '*.cmake' \) -and \
\( \
