[CMake] Success using CPACK_RPM_POST_INSTALL_SCRIPT_FILE
Yvan BARTHÉLEMY
ybart.lists at gmail.com
Wed Sep 1 04:10:36 EDT 2010
Hi,
Since I had some difficulties to use
CPACK_RPM_POST_INSTALL_SCRIPT_FILE, i would like to share the failing
steps I tried and their solution.
First I tried to setup a project containing only one script to be
included as a post-install script into a rpm archive.
The folder archive is like this
/test.sh : The script to be included as post-install script
/CMakeLists.txt : A minimal CMakeLists that enlighten the problem
cmake_minimum_required(VERSION 2.8)
SET(CPACK_PACKAGE_NAME test)
SET(CPACK_PACKAGE_VERSION 1.0)
LIST(APPEND CPACK_GENERATOR RPM)
SET(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "test.sh")
INCLUDE(CPack)
The solution is simple, I just needed to change the line:
SET(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "test.sh")
to:
SET(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/test.sh")
This is needed because CPackRPM needs the absolute path of the file.
CPack does not know that test.sh is relative to source tree.
Credits to Eric Noulard for the solution.
More information about the CMake
mailing list