I would like to run a CMake script before the
INSTALL target (optionally just before building the code).
I have tried using the
install([SCRIPT] <file> [...]) functionality, but that runs during install, which is too late.
The idea is to set the patch part of the
CPACK_PACKAGE_VERSION to the current Git SHA value, but I want to fetch the latest value just before building the install. (I already have a working CMake script to fetch the latest Git SHA). Currently my script requires the use of CMake generate just before triggering the INSTALL to be sure that the Git SHA is updated correctly. Which could lead to inconsistencies if you have pulled in new code since you generated build files.