Get the final install prefix at install-time

Hi @hex !
The subproject containing the examples is included with a simple add_subdirectory().
It’s root CMakeLists.txt includes a module called interface.cmake.
This module contains the code that defines the installation.
When installing the examples subproject, the entire project source dir is copied. A new module called interface.cmake is installed in place of the old one. This new module contains the code that imports the installed library. This setup lets me write the example-specific cmake and completely ignore if the subproject is being used through the main library project or standalone, with the library installed.
That said, the CMAKE_INSTALL_PREFIX is indeed set at configure time, but that’s just a default chosen by GNUInstallDirs or cmake itself. The actual install path can be specified, for example, in the cmake --install cli command. When you run that cli command, the configuration, generation and building phases are already done. I was wondering if it is visible at least to an install script.
Turned out it is, and everything works. The question now is:


Where can I find a complete documentation of what’s available to cmake code ran in install script mode? And in standard script mode (cmake -P)? And a comparison between the two?

Also, as a side note: