From f90174c98cdc7af6c166043e15d178c619f83c99 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 13 Jun 2022 00:08:01 +0200 Subject: build(lint): fix luacheck not found #18940 Problem: Since 6d57bb89c1ee #18543, luacheck is not found on some systems when running the "lintlua" target. Solution: - Move the find_program() to the top-level CMakeLists.txt - Define a def_cmd_target() function with fewer assumptions than the old lint() function. - Move "lintuncrustify" to src/nvim/CMakeLists.txt so it can reuse the $LINT_NVIM_SOURCES already defined there. - Make the lint targets _fatal_ by default. There is little reason for the "lint" umbrella target defined in Makefile to exist if it's going to ignore the absence of the actual linters. - For now, keep the uncrustify call in a separate cmake script so that it can be silenced (too noisy). --- src/nvim/CMakeLists.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index c902ff6c50..1970a68393 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -1,5 +1,7 @@ option(USE_GCOV "Enable gcov support" OFF) +include(DefCmdTarget) + if(USE_GCOV) if(CLANG_TSAN) # GCOV and TSAN results in false data race reports @@ -802,12 +804,22 @@ foreach(sfile ${LINT_NVIM_SOURCES}) endforeach() add_custom_target(lintc DEPENDS ${LINT_TARGETS}) +def_cmd_target(lintuncrustify ${UNCRUSTIFY_PRG} UNCRUSTIFY_PRG false) # Non-fatal so that "lintc" target can depend on it. +if(UNCRUSTIFY_PRG) + add_custom_command(OUTPUT lintuncrustify-cmd APPEND + COMMAND ${CMAKE_COMMAND} + -DUNCRUSTIFY_PRG=${UNCRUSTIFY_PRG} + -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} + -DLINT_NVIM_SOURCES=${LINT_NVIM_SOURCES} + -P ${PROJECT_SOURCE_DIR}/cmake/RunUncrustify.cmake) +endif() + add_custom_target( lintcfull COMMAND ${LINT_PRG} --suppress-errors=${LINT_SUPPRESS_FILE} ${LINT_NVIM_REL_SOURCES} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - DEPENDS ${LINT_PRG} ${LINT_NVIM_SOURCES} ${LINT_SUPPRESS_FILE} + DEPENDS ${LINT_PRG} ${LINT_NVIM_SOURCES} ${LINT_SUPPRESS_FILE} lintuncrustify ) add_custom_target(generated-sources DEPENDS -- cgit