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
I think you may use:
add_executable(MyExampleApp main.cpp) add_library(library STATIC ${ADDITIONAL_SOURCES}) set_target_properties(library PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(MyExampleApp library)