How to handle duplicate targets (add_subdirectory only)

I would very much like to use FetchContent.

But currently there are 3 main reasons we cannot use FetchContent at our company.

Until these 3 issues get fixed we cannot use FetchContent for our large scale code repositories. (All 3 of these issues essentially boil down to speed but in different ways)

1.) Windows performance. Although I know this is getting addressed for 3.21 (https://gitlab.kitware.com/cmake/cmake/-/issues/21703)

2.) We really need the ability to not pull down everything a repo has to offer. Some of our codebases have huge amounts of documentation we don’t want to pulldown. Example say a repo looks like this:

$> ls
src/
docs/
examples/
CMakeLists.txt

We really really don’t want to pull down the docs/examples.

3.) We need a FetchContent source cache. This issue is discussed here: