Can you clarify, what’s the deal with target_sources (… PUBLIC). My initial thought was that it allows to emulate target_include_directories(…PUBLIC) behavior.
so, i thought that
target_sources(foo_lib PUBLIC interface/foo_interface.h)
and
target_include_directories(foo_lib PUBLIC interface)
I’m not deep enough to be sure but my understanding is that target_sources (… PUBLIC...) will cause inclusion of those source files in the source list of all targets that link to this target. In any case probably NOT what one wants. Someone smarter would have to answer that if you want details.
Yes, target_sources just adds source file paths to the list of files for consuming targets. Just like adding arbitrary/path/foo.h does not imply -Iarbitrary/path, if you want -I flags passed, you need to use target_include_directories.
There’s no documentation that indicates that your two examples are implied at all (if there is, please point us to it so it can be updated).