Refer to this: How do I exclude a single file from a cmake `file(GLOB ... )` pattern?
How to exclude multiple files in a single exclude regex command?
Thank You
Refer to this: How do I exclude a single file from a cmake `file(GLOB ... )` pattern?
How to exclude multiple files in a single exclude regex command?
Thank You
How to exclude multiple files in a single exclude regex command?
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
)
or just a loop really:
foreach(ii IN ITEMS
file1
file2
)
list(REMOVE_ITEM lib_srcs ${ii})
endforeach()