CMake exclude dir with a regular expression - Stack Overflow
stackoverflow.com › questions › 63630373Aug 28, 2020 · CMake exclude dir with a regular expression. Bookmark this question. Show activity on this post. file (GLOB_RECURSE Foo_SOURCES "*.c" "*.cpp") # Enter the excluded directories here set (excludeDirName "") list (APPEND excludeDirName "/test") list (APPEND excludeDirName "/std") set (Foo_SOURCES_FILES "") foreach (_sourceFile $ {Foo_SOURCES}) foreach (_excludeDirName $ {excludeDirName}) if (NOT "$ {_sourceFile}" MATCHES " (.*)$ {_excludeDirName} (.*)") list (APPEND Foo_SOURCES_FILES $ ...
how to use EXCLUDE REGEX for multiple files in cmake - Stack ...
stackoverflow.com › questions › 69895977Nov 09, 2021 · Simply write a regex that matches multiple files. Remember about double escaping in CMake. list (FILTER lib_srcs EXCLUDE REGEX "^ (file1|file2|file3)$") Consider doing a function (untested, written here): function (exclude_from_lsit list) foreach (ii IN LISTS ARGV) list (REMOVE_ITEM $ {list} $ {ii}) endforeach () set ($ {list} $ {$ {list}} PARENT_SCOPE) endfunction () exclude_from_list (lib_srcs file1 file2 file3 )
file — CMake 3.20.6 Documentation
cmake.org › cmake › helpList of post-exclude regexes through which to filter the names of resolved dependencies. These arguments can be used to exclude unwanted system libraries when resolving the dependencies, or to include libraries from a specific directory.
list — CMake 3.23.0-rc4 Documentation
cmake.org › cmake › helpA list in cmake is a ; separated group of strings. To create a list the set command can be used. For example, set (var a b c d e) creates a list with a;b;c;d;e, and set (var "a b c d e") creates a string or a list with one item in it. (Note macro arguments are not variables, and therefore cannot be used in LIST commands.)
list — CMake 3.23.0-rc4 Documentation
https://cmake.org/cmake/help/latest/command/list.htmlIntroduction ¶. The list subcommands APPEND, INSERT, FILTER, PREPEND , POP_BACK, POP_FRONT, REMOVE_AT, REMOVE_ITEM , REMOVE_DUPLICATES, REVERSE and SORT may create new values for the list within the current CMake variable scope. Similar to the set () command, the LIST command creates new variable values in the current scope, even if the list ...