Add all files under a folder to a CMake 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

Leave a Comment