mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 09:18:19 +00:00
build(lint): fix luacheck not found #18940
Problem:
Since 6d57bb89c1
#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).
This commit is contained in:
27
cmake/DefCmdTarget.cmake
Normal file
27
cmake/DefCmdTarget.cmake
Normal file
@@ -0,0 +1,27 @@
|
||||
# Defines a target named ${target} and a command with (symbolic) output
|
||||
# ${target}-cmd. If ${prg} is undefined the target prints "not found".
|
||||
#
|
||||
# - Use add_custom_command(…APPEND) to build the command after this.
|
||||
# - Use add_custom_target(…DEPENDS) to run the command from a target.
|
||||
function(def_cmd_target target prg prg_name prg_fatal)
|
||||
# Define a mostly-empty command, which can be appended-to.
|
||||
add_custom_command(OUTPUT ${target}-cmd
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "${target}"
|
||||
)
|
||||
# Symbolic (does not generate an artifact).
|
||||
set_source_files_properties(${target}-cmd PROPERTIES SYMBOLIC "true")
|
||||
|
||||
if(prg OR NOT prg_fatal)
|
||||
add_custom_target(${target}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${target}-cmd)
|
||||
if(NOT prg)
|
||||
add_custom_command(OUTPUT ${target}-cmd APPEND
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "${target}: SKIP: ${prg_name} not found")
|
||||
endif()
|
||||
else()
|
||||
add_custom_target(${target} false
|
||||
COMMENT "${target}: ${prg_name} not found")
|
||||
endif()
|
||||
endfunction()
|
Reference in New Issue
Block a user