I\'ve just read this:
CMake - Automatically add all files in a folder to a target?
With the answer suggesting a file glob, e.g.:
file(GLOB \"
Turning my comment into an answer
If you want to add recursive searching for files use file(GLOB_RECURSE ...)
file(GLOB_RECURSE source_list "*.cpp" "*.hpp")
Your second example would translate into
file(GLOB_RECURSE BAR "src/baz/*.cpp")
References