Having the same problem as here described, I want to execute a shell script as a POST_BUILD command of TARGET "package". Target platform is Debian/Ubuntu.
I add following to the end of my CMakeLists:
add_custom_command(
TARGET package
POST_BUILD
COMMAND bash ${PROJECT_BINARY_DIR}/fixup_deb.sh
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMENT "Fix file-permissions of md5sum files in debian package"
)
But this does not work. When I call "make package" the script doesn't change.
At the moment I have a workaround with a custom target:
add_custom_target(
correctDeb
COMMAND bash ${PROJECT_BINARY_DIR}/fixup_deb.sh
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
But it would be much more comfortable and more fail-safe for me if this would be automagically done when calling "make package".
By the way, generation of ${PROJECT_BINARY_DIR}/fixup_deb.sh works also well with:
configure_file( "${CMAKE_CURRENT_LIST_DIR}/debian/fixup_deb.sh.in" "${PROJECT_BINARY_DIR}/fixup_deb.sh" @ONLY IMMEDIATE )