>
> > set(INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/ssp-suite)
> > install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ssp/" DESTINATION
> ${INSTALL_DIR})
>
Eric already covered this part - use relative paths instead ( no / at the
beginning).
> But I also need to execute a post script, which runs after installation. I
> added
>
> > set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/
> postinstall")
>
> to my CMakeLists.txt and in that script, I am using the RPM variable
> $RPM_INSTALL_PREFIX. But during installation, I get this error message
>
> > chmod: cannot access '/usr/usr/bin/startssp': No such file or directory
> > warning: %post(ssp-suite-7.1-1.x86_64) scriptlet failed, exit status 1
> > Non-fatal POSTIN scriptlet failure in rpm package ssp-suite-7.1-1.x86_64
>
Pre/postinstall scripts are outside what CPackRPM is handling automatically
but you can still use the relocation paths as supported by RPM.
Example for single relocation path:
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr") # this will become the
relocation path - becomes first relocation path
Example for multiple relocation paths:
set(CPACK_RPM_RELOCATION_PATHS "etc/foo" "opt/bar") # two paths that will
be relocatable - etc will become first relocation path and opt the second
one
set(CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION ON) # this will remove the
default /usr from relocation paths
set(CPACK_PACKAGING_INSTALL_PREFIX "/a") # relative paths will be prefixed
with /a - there is a bug that prevents you from using "/" only for
relocation paths so you might decide to patch CPackRPM.cmake yourself [1]
<https://gitlab.kitware.com/cmake/cmake/merge_requests/583/diffs>
Now for the postinstall script each relocation path becomes a variable in
RPM (RPM_INSTALL_PREFIX0 for first relocation path, RPM_INSTALL_PREFIX1 for
the second and so on) so what you have to do in your script is instead of
writing something like this:
chown someone:somegroup /etc/some_non_relocatable_path/some_file
you should write:
chown someone:somegroup
${RPM_INSTALL_PREFIX0}/some_non_relocatable_path/some_file
Regards,
Domen
[1] https://gitlab.kitware.com/cmake/cmake/merge_requests/583/diffs
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake