Allow to combine static libraries together into "meta" static libraries
Let me start with the motivation first. Imagine that we have a project with some complicated library structure, with multiple static libraries' layers, like
libA->libB->libC
\->libD->libE->libF
\->libG
Now, we want to ship libA outside of CMake to some other build system (one of such examples can be a statically configured .xcode project on iOS, or an external client which expects .a and headers from us).
If libA is a shared library, it will link all of it's dependencies into itself, and we'll get a single shared library to which we can set up linking in a straightforward manner, and all of the dependencies to static libs will be "terminated", i.e. they will not "leak" outside of libA (if those are linked privately). The problem occurs when libA is a static library - we will get some (unknown for A, as A might not even know what libB links to) amount of libraries, to which the consumer of libA will also need to link. That can be unmanageable as there can be tens of dependencies linked transitively.
I understand that there're challenges - the most obvious ones being that such a static library linking procedure is only working out-of-the-box, AFAIK, on Darwin-based platforms (and in fact xcode projects - with default setup - do this routinely), and for other platforms it will be harder to make it portable. Also, the user of CMake, if they need it, can potentially implement such a step manually by querying all the dependencies recursively and then setting up their custom command to merge those libraries together, so workarounds do exist.
However, I'm still interested whether CMake developers/community see it as something which Cmake should be able to do out-of-the-box.
Also, I might be missing some other obvious way of achieving it?
Will be happy to provide more examples/motivation if necessary.
Thank you!