MR adds namespaces to project command which can be used for building and packaging multiple different projects as one large build with the following rules: CMake:
- Namespaced projects are not allowed to be nested unless the projects below either don't have a namespace set or have the same namespace (combined they are treated as one namespaced project).
- Multiple namespaced projects can be defined on parallel subdirectories.
- Namespaced projects can be searched by find_package command.
- Each namespaced project can have its own CMAKE_INSTALL_PREFIX.
- Inside a namespaced project install(EXPORT) commands should not/don't need to set the namespace parameter.
- Namespace parameter for install(EXPORT) is automatically suffixed by ::
- Each namespaced project can be packaged separately as if it were a separate build tree.
- Namespaced project version is automatically used as CPack packages version.
- CMake install prefix can be automatically used as CPack packaging install prefix.
- Namespace specific variables can override default variables if set (current naming convention is CPACK_ns_ns... which I'll probably change to CPACK_...NAMESPACE or something similar).
- Each namespaced projects sets its own components so that CPack can use those to produce per namespace packages.
The best reference of how I imagined it to be used is to look at the provided tests.
Currently there is only one CPack test with two subtests (first using namespaces and the second using ExternalProject to produce the same binary packages) and support for binary packages only. If the direction in which I am going with this is acceptable I'd also add additional tests, support for source packages and cmake server support.
Later I can also split the MR into multiple MRs since it's getting quite big.
@brad.king Would any (all?) of this be accepted and worth pursuing further?