I have a CMakeLists.txt in my project root and one in my /src folder. The one in the /src folder only contains a variable with the .cpp files (set (SOURCEFILES main.cpp foo.cpp)
) and in the root CMakeLists.txt I do add_subdirectory(src)
and later I do add_executable(MyApp ${SOURCEFILES})
.
But cmake gives me the error
add_executable called with incorrect number of arguments, no sources provided
How do I get cmake to see the variable? I read that cmake only knows global variables, but that's obviously not the case...