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
PARENT_SCOPE is only for parent, it won't work if you have other non-parent script that want to see it as well.
You need cache for the true "global-like" variable. In your case, use:
SET(source_list "${source_list}" CACHE INTERNAL "source_list")