From 463a0f79f0149b5f1f2c4cff0fa390bd7f9a8a84 Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Thu, 14 Nov 2024 01:07:11 +0200 Subject: [PATCH] Prevent trailing space --- src/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d5e8c79c0..ee6b0bb0b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -101,6 +101,18 @@ set_target_properties (gvm-pg-server PROPERTIES SOVERSION "${CPACK_PACKAGE_VERSI set_target_properties (gvm-pg-server PROPERTIES VERSION "${CPACK_PACKAGE_VERSION}") include_directories (${PostgreSQL_INCLUDE_DIRS} ${PostgreSQL_SERVER_INCLUDE_DIRS}) +## Precommit-like checks + +if (NOT CMAKE_BUILD_TYPE MATCHES "Release") + add_custom_target(check-whitespace ALL + # once for output + COMMAND grep -Hn "[ ]$$" *.c *.h | sed "'s/^\\(.\\+:.\\+:\\)/\\1 error: trailing space: /'" + # again for exit code + COMMAND ! grep --quiet "[ ]$$" *.c *.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Checking whitespace...") +endif (NOT CMAKE_BUILD_TYPE MATCHES "Release") + ## Program add_executable (manage-utils-test