As mentioned in the set command documentation, every directory added with add_subdirectory or every function declared with function creates a new scope.
The new child region inherits all variable definitions from its parent region. Assignment variables in the new child region using the set command will only be visible in the child region unless the PARENT_SCOPE parameter is PARENT_SCOPE .
To make the SOURCEFILES visible in the root folder of your project, try:
set (SOURCEFILES main.cpp foo.cpp PARENT_SCOPE)
sakra Jul 31 '11 at 18:45 2011-07-31 18:45
source share