I got lost in your explanation very quickly. But maybe it will make more sense to others, so let’s wait for other replies.
What I didn’t understand is why there would be more than one FetchContent
for the same dependency in the same project and why would you still try to call find_package()
after FetchContent
(even though you seem to understand that it should not be so).
As for transitive dependencies - certainly, if a dependency that is resolved with FetchContent
has dependencies of its own (and it does not resolve them by itself), then you would need to resolve them yourself beforehand. I have actually made an example project for a similar case recently, where a project resolves png
which transitively depends on zlib
, so you might want to take a loot at that.
In general, I would definitely recommend using a proper package manager for resolving dependencies, such as vcpkg or Conan.