From d02a82b71f776d3a317f03b5be891d86feeeff38 Mon Sep 17 00:00:00 2001
From: Jens Georg <jens.georg@desy.de>
Date: Fri, 3 Mar 2023 15:22:03 +0100
Subject: [PATCH] coding-style-check: Skip if clang-format not found (#23)

---
 cmake/check-coding-style.sh         | 1 +
 cmake/enable_code_style_check.cmake | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/cmake/check-coding-style.sh b/cmake/check-coding-style.sh
index 26bb997..ad99511 100755
--- a/cmake/check-coding-style.sh
+++ b/cmake/check-coding-style.sh
@@ -18,6 +18,7 @@ if which clang-format-14 > /dev/null; then
     echo "Code formatting incorrect!"
   fi
 else
+  echo 77 > "${ERRFILE}"
   echo "WARNING: clang-format-14 not found, code formatting not checked!"
 fi
 
diff --git a/cmake/enable_code_style_check.cmake b/cmake/enable_code_style_check.cmake
index efac67d..80dda5a 100644
--- a/cmake/enable_code_style_check.cmake
+++ b/cmake/enable_code_style_check.cmake
@@ -20,3 +20,6 @@
 enable_testing()
 add_test(NAME coding_style COMMAND ${CMAKE_SOURCE_DIR}/cmake/check-coding-style.sh ${CMAKE_BINARY_DIR}
                            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+
+# coding style will return 77 if no clang-format-14 could be found AND none of the other tests fail
+set_property(TEST coding_style PROPERTY SKIP_RETURN_CODE 77)
-- 
GitLab