Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

My problem of compiling with multiple executables was due to the fact that I was including 2 or more main functions within add_library because the add_library takes from the file(GLOB ${PROJECT_NAME}_src.. part, and it had a regex that took 2 or more executables.

The solution is to put your executables in a folder that isn't grabbed by the file(GLOB ${PROJECT_NAME}_src.. part and when you declare executables using add_executable, make sure to include within target_link_libraries the ${PROJECT_NAME variable, which is usually all non-executable .cpp files in your package.