How to make a subproject to be inside a project?

Hello. Let’s imagine a situation - there is a main project MainPrj and a subroject SubPrj, which is fetched as git submodule. SubPrj is self-sufficient cmake project with its own install target. MainPrj is mine, SubPrj is someone else’s, i can not modify it. If i add SubPrj to MainPrj via add_subdirectory(), then the install target will populate a destination as if the projects are independent of each other, each in its own directory. I would like SubPrj to be installed under some MainPrj install directory. For exapmle - desired install layout:

└── include
    └── MainPrj
        ├── main.h
        └── SubPrj
            └── sub.h

I.e, I would like to somehow set the prefix for SubPrj, so that SubPrj is used exclusive by MainPrj and does not create any name collisions in the global space. Do I have any options besides installing in /opt or rewriting CMakeLists.txt for SubPrj? I have considered ExternalProject_add() and execut_process(), but I don’t think that it is what i need . Thank you in advance.

If SubPj doesn’t allow for manipulation of its install prefixes through variables (such as GNUInstallDirs) or other means, you’ll have to patch it. Said another way, if a project just says DESTINATION "include/me" literally, there’s no override available for it.