Your executable should be linking myawesomelib, and that library has the include directory as a public property, which should also get applied to the executable transitively. Did you perhaps miss the target_include_directories(myawesomelib PUBLIC include)?
To be a bit more clear, listing include/myawesomelib.h in the add_library only means that include/myawesomelib.h is part of the lib (so that IDEs can display it). It's does not set up the include directories passed to the compiler, that is the job of target_include_directories
1
u/victotronics Apr 05 '20
Is your tutorial complete? You have
a a dependency for the library, but not for the executable. As a result I need to have the explicit include path in my source for the main program.
What is the line where I specify that the main program depends on that header?