From f5f6e5307d4dc244efb5977e466a26955cee426a Mon Sep 17 00:00:00 2001 From: David Adam Date: Tue, 19 Feb 2019 21:12:04 +0800 Subject: [PATCH] cmake: add lint/lint-all targets --- CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f04abb97d..b0b518aa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,5 +178,20 @@ INCLUDE(cmake/Install.cmake) # Mac app. INCLUDE(cmake/MacApp.cmake) +# Lint targets +# This could be implemented as target properties, but the script has the useful feature of only +# checking the currently-staged commands +# The generator expressions below rebuild the command line for the fishlib targets +# CMake does not support the "iquote" flag - https://gitlab.kitware.com/cmake/cmake/issues/15491 +SET(LINT_ARGS "-D$, -D>" "-I$, -I>") +ADD_CUSTOM_TARGET(lint + COMMAND build_tools/lint.fish -- ${LINT_ARGS} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" +) +ADD_CUSTOM_TARGET(lint-all + COMMAND build_tools/lint.fish --all -- ${LINT_ARGS} + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" +) + INCLUDE(FeatureSummary) FEATURE_SUMMARY(WHAT ALL)