How to get the packaging directory in a CPACK_PRE_BUILD_SCRIPTS ?

Hi,

when creating a package, I’d like to run some commands on the installed, but not yet packaged executables.
in the scripts in CPACK_INSTALL_SCRIPTS there is the variable CMAKE_INSTALL_PREFIX set to the directory where the temporarily installed files are located.
How do I get to this information in CPACK_PRE_BUILD_SCRIPTS (and maybe CPACK_POST_BUILD_SCRIPTS) ?
(CPACK_PACKAGE_DIRECTORY and CPACK_INSTALL_PREFIX also don’t give me the temporary install dir.)
Is there a reason that CMAKE_PREFIX_PATH is not set the same way when executing those two scripts ?

Ok, I found it in the cmake sources, there are CPACK_TEMPORARY_INSTALL_DIRECTORY and CPACK_TEMPORARY_DIRECTORY (which both point to the same, correct directory) and also CPACK_NATIVE_INSTALL_DIRECTORY. Unfortunately all of them are undocumented.

You can find a previous discussion about this topic here: https://gitlab.kitware.com/cmake/cmake/-/issues/21520

Thanks.
In 2006 the variables CPACK_TEMPORARY_INSTALL_DIRECTORY and CPACK_TEMPORARY_DIRECTORY were still different:
https://gitlab.kitware.com/cmake/cmake/-/blame/3eea1990f51ef8d8a2c1e006a4f2fe089a64b836/Source/CPack/cmCPackGenericGenerator.cxx?page=1

Since 2008 those two variables are the same:
https://gitlab.kitware.com/cmake/cmake/-/commit/1105a86c520d34a59b482b86b6f288c11ff45b81
Which one should be the “official” one ?
I think I’d prefer CPACK_TEMPORARY_INSTALL_DIRECTORY, the other one sounds more like a place for random temporary stuff.

I created a merge request: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8566