target_sources — CMake 3.23.0-rc3 Documentation
cmake.org › latest › commandEach target_sources (FILE_SET) entry starts with INTERFACE, PUBLIC, or PRIVATE and accepts the following arguments: The name of the file set to create or add to. It must contain only letters, numbers and underscores. Names starting with a capital letter are reserved for built-in file sets predefined by CMake.
[CMake] Exclude file from build on a given target
cmake.org › pipermail › cmakeIf you want to exclude certain source files from certain targets you can use a list and then list(REMOVE_ITEM...) set(FOO_SRCS foo.cc bar.cc) list(REMOVE_ITEM FOO_SRCS bar.cc) add_library(foo ${FOO_SRCS}) Alternatively, only add the unusual source files to the targets you want. set(FOO_SRCS foo.cc bar.cc) if(WHATEVER)