neovim/cmake/RunLuacheck.cmake

23 lines
651 B
CMake
Raw Normal View History

2017-05-25 06:50:06 -07:00
set(LUACHECK_ARGS -q "${LUAFILES_DIR}")
if(DEFINED IGNORE_PATTERN)
list(APPEND LUACHECK_ARGS --exclude-files "${LUAFILES_DIR}/${IGNORE_PATTERN}")
endif()
if(DEFINED CHECK_PATTERN)
list(APPEND LUACHECK_ARGS --include-files "${LUAFILES_DIR}/${CHECK_PATTERN}")
endif()
if(DEFINED READ_GLOBALS)
list(APPEND LUACHECK_ARGS --read-globals "${READ_GLOBALS}")
endif()
execute_process(
2017-05-25 06:50:06 -07:00
COMMAND "${LUACHECK_PRG}" ${LUACHECK_ARGS}
WORKING_DIRECTORY "${LUAFILES_DIR}"
ERROR_VARIABLE err
RESULT_VARIABLE res
2017-05-25 06:50:06 -07:00
)
if(NOT res EQUAL 0)
message(STATUS "Output to stderr:\n${err}")
2018-10-06 09:45:34 -07:00
message(FATAL_ERROR "Linting tests failed with error: ${res}")
endif()