Given I have defined an executable with its main source file in a CMakeList.txt file:
CMakeList.txt
ADD_EXECUTABLE(MyExampleApp main.cpp)
Can I
Use target_sources, available since cmake 3.1
target_sources
eg. target_sources(MyExampleApp PRIVATE ${extra_file})
target_sources(MyExampleApp PRIVATE ${extra_file})
https://cmake.org/cmake/help/v3.1/command/target_sources.html