I was looking into what variables we document as being available to
install(CODE). I was surprised that we don’t seem to document any. I expect that at the very least, we would guarantee that
CMAKE_INSTALL_PREFIX would be defined,. We also don’t make any guarantees about the working directory (that I could find). Without
CMAKE_INSTALL_PREFIX being documented as available or the working directory guaranteed, you would have no documented way to install anything or access things that have already been installed.
I suspect anyone using these
install() subcommands already assumes
CMAKE_INSTALL_PREFIX is defined. It seems to be one of the first things defined in the
cmake_install.cmake script we generate. Is there any reason we can’t formally document it as always being defined and available? Given that it seems this variable has always been defined and available (from what I can tell, but would be good to confirm), we could add it now (even for 3.22) and not need a