diff options
author | Florian Walch <florian@fwalch.com> | 2014-12-13 02:20:34 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-12-24 00:32:26 -0500 |
commit | e21f6e754d87478d05a683224cab352fe5271e2a (patch) | |
tree | 3714a9faaf30eb4f62f1340f9e2bdd1fe291c0c2 /cmake | |
parent | aa08632caf80d2259d94e8f6e30cd806e3c05a1d (diff) | |
download | rneovim-e21f6e754d87478d05a683224cab352fe5271e2a.tar.gz rneovim-e21f6e754d87478d05a683224cab352fe5271e2a.tar.bz2 rneovim-e21f6e754d87478d05a683224cab352fe5271e2a.zip |
Linting: Integrate into CMake, enable by default.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/RunLint.cmake | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cmake/RunLint.cmake b/cmake/RunLint.cmake new file mode 100644 index 0000000000..35d3f942aa --- /dev/null +++ b/cmake/RunLint.cmake @@ -0,0 +1,21 @@ +get_filename_component(LINT_DIR ${LINT_DIR} ABSOLUTE) +get_filename_component(LINT_PREFIX ${LINT_DIR} PATH) +file(GLOB_RECURSE LINT_FILES ${LINT_DIR}/*.c ${LINT_DIR}/*.h) + +if(LINT_IGNORE_FILE) + file(READ ${LINT_IGNORE_FILE} LINT_IGNORED_FILES) + string(REPLACE "\n" ";" LINT_IGNORED_FILES ${LINT_IGNORED_FILES}) + message(STATUS "Ignoring the following files for linting:") + foreach(ignore_file ${LINT_IGNORED_FILES}) + message(STATUS "${ignore_file}") + list(REMOVE_ITEM LINT_FILES "${LINT_PREFIX}/${ignore_file}") + endforeach() +endif() + +execute_process( + COMMAND ${LINT_PRG} ${LINT_FILES} + RESULT_VARIABLE res) + +if(NOT res EQUAL 0) + message(FATAL_ERROR "Linting failed: ${res}.") +endif() |