How can I prepend all filenames on the list with a common path prefix automatically? For instance having a list of files in CMakeLists.txt:
SET(SRC_FILES foo
I assume that you want an absolute filename as you are prepending ${CMAKE_CURRENT_SOURCE_DIR}. If you are using FILE(GLOB , all the files will have an absolute path already:
file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
See the comments CMake in documentation on why not to use GLOB to add source files.