While cleaning up the docs for the new CPACK_PRE_BUILD_SCRIPTS, CPACK_POST_BUILD_SCRIPTS and CPACK_PACKAGE_FILES variables added by !4846, I noticed that we already have CPACK_INSTALL_SCRIPTS. This seems to already provide the capabilities that CPACK_PRE_BUILD_SCRIPTS aims to cover. The naming for CPACK_PRE_BUILD_SCRIPTS is clearer now that we also have post-build capabilities, but this raises some questions:

  • Do we have the same guaranteed variables set for CPACK_PRE_BUILD_SCRIPTS as we do for CPACK_INSTALL_SCRIPTS? This would include CMAKE_CURRENT_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_INSTALL_PREFIX.
  • Should we update the docs for CPACK_INSTALL_SCRIPTS to say to prefer to use CPACK_PRE_BUILD_SCRIPTS instead?
  • Should we mark CPACK_INSTALL_SCRIPTS as deprecated?

Some related background material:

Cc: @zaufi

My comparison between CPACK_INSTALL_SCRIPTS and CPACK_PRE_BUILD_SCRIPTS is incorrect. The former occurs before targets are even installed, the latter occurs after install but before packages are built. I’ll update the docs to make this clearer and put up a MR for this today.

MR can be found here:

Huh, I’ve missed your post… %)
But yeah, that is just a different stage of package building.

CPACK_INSTALL_SCRIPTS similar to install(CODE|SCRIPT), but works only when CPack performs install.

CPACK_PRE_BUILD_SCRIPTS aimed to do smth w/ staged files before they are going to be packed. For example, sign executables.

CPACK_POST_BUILD_SCRIPTS is for doing smth w/ just built packages. For example, sign them (e.g. RPM/DEB/NuGet).