Inconsistent use of CPACK_TEMPORARY_DIRECTORY and CPACK_TEMPORARY_INSTALL_DIRECTORY
It looks like most of the CPack code uses CPACK_TEMPORARY_DIRECTORY
when it wants to refer to the staging area where a project is installed to. But it is actually CPACK_TEMPORARY_INSTALL_DIRECTORY
that is used when the project is installed. It just so happens that by default, both variables have the same value. From what I can tell, they should always be the same, and it looks like things would break if they aren't. It appears to be a bug that we have two different variables for this, but since they default to the same value and neither is documented as writable (see below), we currently get away with it. !8566 (closed) proposes to start documenting at least one of the two, but that will then open us up to a stronger likelihood that we will encounter cases where the values may differ. Also see #21520 for context.
The CPACK_TEMPORARY_DIRECTORY
variable is already mentioned briefly in the documentation for the External
CPack generator. That documentation is technically inaccurate, since it is CPACK_TEMPORARY_INSTALL_DIRECTORY
that specifies/controls where the staging install happens, not CPACK_TEMPORARY_DIRECTORY
(CC: @kyle.edwards). There is a similar error in the code comments in cmCPackGenerator.cxx
. The CPACK_TEMPORARY_INSTALL_DIRECTORY
isn't currently mentioned anywhere in the docs at all.
It is clear that there will already be projects in the wild that use these two variables, despite them being undocumented. Any change that seeks to address the problem of having two separate variables for this will need to consider how to avoid breaking such projects. It seems likely that any such change would need a policy, but since this problem is in cpack rather than cmake, our ability to solve this with a policy may be restricted.