Canonical folder structure for very large C++ project with multiple subprojects (that may have subprojects of their own)

I know there is technically no “standard” to C++ project structure, but I am working on my own set of C++ libraries that is quickly growing and the project structure is getting out of hand.

Right now I have a bunch of separate CMake projects with the following structure (which seems to be the canonical CMake project structure for a simple project):

project/     CMakeLists.txt     doc/     include/     src/     test/ 

These libraries all have their own git repositories and are managed separately, but I am finding that many of the libraries have somewhat related functionality so it would make a lot of sense to put them in one “super” project that has subprojects of the different related libraries. The issue with this, is there doesn’t seem to be any standard structure to do this.

I was thinking I might do something like this…:

superproject/     CMakeLists.txt     project1/         CMakeLists.txt         doc/         include/         src/         test/     project2/         CMakeLists.txt         doc/         src/         test/     etc... 

But then there’s the issue of how do I structure it when one of my subprojects has a subproject of its own? Adding another project folder under one of the subprojects with its own doc/ include/ src/ and test/ folders seems like its getting a bit messy…

I know there are some HUGE C++ projects out there (on the order of 10s of millions of lines of code)… so someone has to have figured out a very good way to keep things organized. What do most companies do when faced with this problem. Is there any “standard” way to approach this?