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.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to