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...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…