I have a project in which i have essentially two main methods. One for testing and one for, well, running the code. Normally you would create submodules, but this is not an option.
file(GLOB sources "*.cpp")
file(GLOB headers "*.h")
add_executable(testing ${sources} ${headers})
add_executable(main ${sources} ${headers})
So testing should compile all sources except for main.cpp. Main should compile everything but testing.cpp.
The normal way would probably be to create a library from all the sources except main.cpp and testing.cpp, then link this to each executable. However, I guess you mean you can't do that when you say you can't create submodules.
Instead, you can use the
list(REMOVE_ITEM ...)
command: