I\'m writing a CMakeLists.txt to generate files and compile the generated files. I create a function to add some file path strings to a global list variable.
My CMak
You need to use set instead of list to affect the variable in the parent scope.
set
list
So replace your list command with:
set(source_list ${source_list} ${file_path} PARENT_SCOPE)