mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
build: add EXCLUDE option to add_glob_target
EXCLUDE filters out all elements containing regex, meaning it works on both files and directories. Also rename add_glob_targets to add_glob_target since only one target is being created.
This commit is contained in:
@ -611,7 +611,7 @@ find_program(STYLUA_PRG stylua)
|
||||
find_program(UNCRUSTIFY_PRG uncrustify)
|
||||
find_program(SHELLCHECK_PRG shellcheck)
|
||||
|
||||
add_glob_targets(
|
||||
add_glob_target(
|
||||
REQUIRED
|
||||
TARGET lintlua-luacheck
|
||||
COMMAND ${LUACHECK_PRG}
|
||||
@ -621,7 +621,7 @@ add_glob_targets(
|
||||
TOUCH_STRATEGY SINGLE
|
||||
)
|
||||
|
||||
add_glob_targets(
|
||||
add_glob_target(
|
||||
TARGET lintlua-stylua
|
||||
COMMAND ${STYLUA_PRG}
|
||||
FLAGS --color=always --check
|
||||
@ -635,7 +635,7 @@ add_dependencies(lintlua lintlua-luacheck lintlua-stylua)
|
||||
|
||||
include(InstallHelpers)
|
||||
|
||||
add_glob_targets(
|
||||
add_glob_target(
|
||||
TARGET lintsh
|
||||
COMMAND ${SHELLCHECK_PRG}
|
||||
FILES scripts/vim-patch.sh
|
||||
|
@ -49,12 +49,13 @@
|
||||
# simple be added to FILES
|
||||
# GLOB_DIRS - The directories to recursively search for files with extension
|
||||
# GLOB_PAT
|
||||
#
|
||||
function(add_glob_targets)
|
||||
# EXCLUDE - List of paths to skip (regex). Works on both directories and
|
||||
# files.
|
||||
function(add_glob_target)
|
||||
cmake_parse_arguments(ARG
|
||||
"REQUIRED"
|
||||
"TARGET;COMMAND;GLOB_PAT;TOUCH_STRATEGY"
|
||||
"FLAGS;FILES;GLOB_DIRS"
|
||||
"FLAGS;FILES;GLOB_DIRS;EXCLUDE"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
@ -72,7 +73,15 @@ function(add_glob_targets)
|
||||
endif()
|
||||
|
||||
foreach(gd ${ARG_GLOB_DIRS})
|
||||
file(GLOB_RECURSE globfiles ${PROJECT_SOURCE_DIR}/${gd}/${ARG_GLOB_PAT})
|
||||
file(GLOB_RECURSE globfiles_unnormalized ${PROJECT_SOURCE_DIR}/${gd}/${ARG_GLOB_PAT})
|
||||
set(globfiles)
|
||||
foreach(f ${globfiles_unnormalized})
|
||||
file(TO_CMAKE_PATH "${f}" f)
|
||||
list(APPEND globfiles ${f})
|
||||
endforeach()
|
||||
foreach(exclude_pattern ${ARG_EXCLUDE})
|
||||
list(FILTER globfiles EXCLUDE REGEX ${exclude_pattern})
|
||||
endforeach()
|
||||
list(APPEND ARG_FILES ${globfiles})
|
||||
endforeach()
|
||||
|
||||
|
@ -772,7 +772,7 @@ add_custom_target(uncrustify-version
|
||||
-D CONFIG_FILE=${PROJECT_SOURCE_DIR}/src/uncrustify.cfg
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/CheckUncrustifyVersion.cmake)
|
||||
|
||||
add_glob_targets(
|
||||
add_glob_target(
|
||||
TARGET lintuncrustify
|
||||
COMMAND ${UNCRUSTIFY_PRG}
|
||||
FLAGS -c "${PROJECT_SOURCE_DIR}/src/uncrustify.cfg" -q --check
|
||||
|
Reference in New Issue
Block a user