Automatic namespace generation
The project namespace is used to place version info functions in it and for info function name generation when it is desired to no to use namespace directly. The [INTERFACE_]UTK_CMAKE_PROJECT_NAMESPACE target property stores the project namespace as a list of names of hierarchical namespaces.
The value of the [INTERFACE_]UTK_CMAKE_PROJECT_NAMESPACE property may come out of sync with the actual project namespace.
The solution to this problem is automatic project namespace generating and providing a macro definition for opening and closing the project namespace. This way it is possible to resolve multiple issues:
-
prevent [INTERFACE_]UTK_CMAKE_PROJECT_NAMESPACE value going out of sync with the actual project namespace;
-
decrease nesting level for code that is in the root of the project namespace;
-
allow improved API versioning control; this is especially useful for header-only libraries that may benefit from each version having its own namespace.
In case of libraries that require major-version-based API versioning, it is possible to provide convenience macros for major-version-based namespace names. It is possible to make these macros stable by producing macros for each of the last several versions (e.g. for versions 4,3,2 if the current major version is 4).