diff options
author | dundargoc <gocdundar@gmail.com> | 2022-11-01 14:29:17 +0100 |
---|---|---|
committer | dundargoc <gocdundar@gmail.com> | 2022-11-01 18:34:14 +0100 |
commit | aeb87f8b4a87e99c392e7ec11b29b715e1f31ac3 (patch) | |
tree | 03783db9a7d922898860433ea7595f44c4d8d8e8 /cmake | |
parent | b05d1943f063c382ea96b76d250877bc58297314 (diff) | |
download | rneovim-aeb87f8b4a87e99c392e7ec11b29b715e1f31ac3.tar.gz rneovim-aeb87f8b4a87e99c392e7ec11b29b715e1f31ac3.tar.bz2 rneovim-aeb87f8b4a87e99c392e7ec11b29b715e1f31ac3.zip |
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.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Util.cmake | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/cmake/Util.cmake b/cmake/Util.cmake index 343a729305..a86ced89d6 100644 --- a/cmake/Util.cmake +++ b/cmake/Util.cmake @@ -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() |