Namespace support for target names in nested projects
Currently in CMake, there seems to be a very nice option of
NAMESPACE for the
INSTALL(EXPORT ...) command. This could save a lot of trouble for the users of the project about conflicts in target names.
However, if for some reason, the project is nested inside the source tree of the user project, for example, by using
git submodule, when using
add_subdirectory to add the subproject, the target names in the subproject are fixed. So the users have to be careful about the conflict of target names.
So I guess maybe it can probably be nice if the
add_subdirectory command can have something similar to the
NAMESPACE option, so that the target names defined in the nested directory, either with or without a
project call in itself, could be renamed with a prefix in the scope of the user. Any comments or suggestions about alternatives will be appreciated!