mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +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(UNCRUSTIFY_PRG uncrustify)
|
||||||
find_program(SHELLCHECK_PRG shellcheck)
|
find_program(SHELLCHECK_PRG shellcheck)
|
||||||
|
|
||||||
add_glob_targets(
|
add_glob_target(
|
||||||
REQUIRED
|
REQUIRED
|
||||||
TARGET lintlua-luacheck
|
TARGET lintlua-luacheck
|
||||||
COMMAND ${LUACHECK_PRG}
|
COMMAND ${LUACHECK_PRG}
|
||||||
@@ -621,7 +621,7 @@ add_glob_targets(
|
|||||||
TOUCH_STRATEGY SINGLE
|
TOUCH_STRATEGY SINGLE
|
||||||
)
|
)
|
||||||
|
|
||||||
add_glob_targets(
|
add_glob_target(
|
||||||
TARGET lintlua-stylua
|
TARGET lintlua-stylua
|
||||||
COMMAND ${STYLUA_PRG}
|
COMMAND ${STYLUA_PRG}
|
||||||
FLAGS --color=always --check
|
FLAGS --color=always --check
|
||||||
@@ -635,7 +635,7 @@ add_dependencies(lintlua lintlua-luacheck lintlua-stylua)
|
|||||||
|
|
||||||
include(InstallHelpers)
|
include(InstallHelpers)
|
||||||
|
|
||||||
add_glob_targets(
|
add_glob_target(
|
||||||
TARGET lintsh
|
TARGET lintsh
|
||||||
COMMAND ${SHELLCHECK_PRG}
|
COMMAND ${SHELLCHECK_PRG}
|
||||||
FILES scripts/vim-patch.sh
|
FILES scripts/vim-patch.sh
|
||||||
|
@@ -49,12 +49,13 @@
|
|||||||
# simple be added to FILES
|
# simple be added to FILES
|
||||||
# GLOB_DIRS - The directories to recursively search for files with extension
|
# GLOB_DIRS - The directories to recursively search for files with extension
|
||||||
# GLOB_PAT
|
# GLOB_PAT
|
||||||
#
|
# EXCLUDE - List of paths to skip (regex). Works on both directories and
|
||||||
function(add_glob_targets)
|
# files.
|
||||||
|
function(add_glob_target)
|
||||||
cmake_parse_arguments(ARG
|
cmake_parse_arguments(ARG
|
||||||
"REQUIRED"
|
"REQUIRED"
|
||||||
"TARGET;COMMAND;GLOB_PAT;TOUCH_STRATEGY"
|
"TARGET;COMMAND;GLOB_PAT;TOUCH_STRATEGY"
|
||||||
"FLAGS;FILES;GLOB_DIRS"
|
"FLAGS;FILES;GLOB_DIRS;EXCLUDE"
|
||||||
${ARGN}
|
${ARGN}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -72,7 +73,15 @@ function(add_glob_targets)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(gd ${ARG_GLOB_DIRS})
|
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})
|
list(APPEND ARG_FILES ${globfiles})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
@@ -772,7 +772,7 @@ add_custom_target(uncrustify-version
|
|||||||
-D CONFIG_FILE=${PROJECT_SOURCE_DIR}/src/uncrustify.cfg
|
-D CONFIG_FILE=${PROJECT_SOURCE_DIR}/src/uncrustify.cfg
|
||||||
-P ${PROJECT_SOURCE_DIR}/cmake/CheckUncrustifyVersion.cmake)
|
-P ${PROJECT_SOURCE_DIR}/cmake/CheckUncrustifyVersion.cmake)
|
||||||
|
|
||||||
add_glob_targets(
|
add_glob_target(
|
||||||
TARGET lintuncrustify
|
TARGET lintuncrustify
|
||||||
COMMAND ${UNCRUSTIFY_PRG}
|
COMMAND ${UNCRUSTIFY_PRG}
|
||||||
FLAGS -c "${PROJECT_SOURCE_DIR}/src/uncrustify.cfg" -q --check
|
FLAGS -c "${PROJECT_SOURCE_DIR}/src/uncrustify.cfg" -q --check
|
||||||
|
Reference in New Issue
Block a user