Skip to content

CPack: Handle internal variables CPACK_TEMPORARY_[INSTALL]_DIRECTORY properly

Deniz Bahadir requested to merge dbahadir/cmake:fix-issue-25046 into master

The variable CPACK_TEMPORARY_DIRECTORY is an internal variable that is required for proper packaging. Historically, a second variable CPACK_TEMPORARY_INSTALL_DIRECTORY existed as well which had the same purpose.
Both variables had to be set to the same value. Otherwise, CPack would not succeed with packaging.

In order to ease CPack's usage, the variable CPACK_TEMPORARY_INSTALL_DIRECTORY is now no longer used.

However, as it cannot be guaranteed that neither of these two (internal) variables have been used in the wild, some mechanism was introduced to preserve backwards-compatibility:

  • If one of these variables is set, the other variable will be set to the same value.
  • If, however, both are set to different values, CPack still fails but with an explicit error-message.

Note, that this merge-request explicitly does neither try to replace these variables with a variable with a more properly fitting name (e.g. CPACK_STAGING_DIRECTORY) nor does it try to document these variables. (Replacing them by CPACK_STAGING_DIRECTORY and properly documenting that variable should be addressed by another issue / merge-request.)
It just enforces that only one of these variables is used internally and that it still keeps backwards-compatibility in case some projects in the wild already (ab)use these variables. Additionally, it should fail gracefully, if these two variables have conflicting values.


Fixes: #25046 (closed)
Topic-rename: cpack-temp-var

Edited by Deniz Bahadir

Merge request reports