CPACK_PRE_BUILD_SCRIPTS and CPACK_POST_BUILD_SCRIPTS have no obvious way to access the source, binary or staging directories
The CPACK_INSTALL_SCRIPTS
run with the following variables set:
CMAKE_CURRENT_SOURCE_DIR
CMAKE_CURRENT_BINARY_DIR
-
CMAKE_INSTALL_PREFIX
- set to staging directory
These variables don't get set for the CPACK_PRE_BUILD_SCRIPTS
and the CPACK_POST_BUILD_SCRIPTS
unless you have a CPACK_INSTALL_SCRIPTS
running first.
You can get some of the information you need from CPACK variables:
-
CPACK_TEMPORARY_INSTALL_DIRECTORY
- is set to the staging directory in_PRE_
-
CPACK_OUTPUT_FILE_PATH
- points to the output file in_POST_
I think it would be useful for CMAKE_CURRENT_SOURCE_DIR
and CMAKE_CURRENT_BINARY_DIR
to be set for both PRE and POST. CMAKE_INSTALL_PREFIX
set for PRE and something else set pointing to the output file in POST.