Using the same namespace for multiple independant projects

Is there a way to use the same namespace accross multiple packages, like:

target_link_librairies(target PUBLIC prog::extA prog::extB)

Or even, register multiple packages in the same “meta”-package, like:

target_link_librairies(target PUBLIC prog::extA prog::extB)

But without the use of the component mechanism, which would require that all extensions are handled in the same CMake project. My goal is to be able to build sub-packages in fully independant CMake projects. And from my understanding, it is not possible with the component mechanism(?)


There’s no rule about namespaces having to match the package name in general, so prog_extA and prog_extB can both use NAMESPACE prog:: just fine.

And Qt does the second part as well (using COMPONENTS to look for the “extensions”).