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