2018-01-04 22:42 GMT+01:00 Sam Lunt <sam.l...@transmarketgroup.com>: > Hi Domen, > > Thanks for the reply, but that doesn't seem to work for me. I modified > my example to add this function call: > > list(APPEND CPACK_RPM_RELOCATION_PATHS > ${CPACK_PACKAGING_INSTALL_PREFIX} > ) >
The documentation states that CPACK_PACKAGING_INSTALL_PREFIX is prepended so the way you are using it not how it is supposed to be used. With your example above I'd do something like this: include(GNUInstallDirs) install(TARGETS foo DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT Foo_Comp ) install(TARGETS bar DESTINATION "a/b/c" COMPONENT Bar_Comp ) list(APPEND CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_BINDIR}" "a/b/c" ) set(CPACK_PACKAGING_INSTALL_PREFIX "/") This will make "/", "/${CMAKE_INSTALL_BINDIR}" and "/a/b/c" relocatable (and if you want to skip / just set CPACK_PACKAGING_INSTALL_PREFIX). There was a bug in older versions of CPack that CPACK_PACKAGING_INSTALL_PREFIX could not be set to / (it was fixed by this commit https://gitlab.kitware.com/cmake/cmake/merge_requests/583/diffs in CMake 3.9 so you can backport it if you want to as it is a small change to CPackRPM.cmake file). > > that silences the warnings, but it still prepends the > CPACK_PACKAGING_INSTALL_PREFIX when generating the RPM files, while I > want it to prepend CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX. > > So if I call "rpm -qlp FooBar-0.1.0-Linux-Bar_Comp.rpm", it outputs: > /tmp_dir/foobar > /tmp_dir/foobar/bin > /tmp_dir/foobar/bin/bar > > (CPACK_PACKAGING_INSTALL_PREFIX = /tmp_dir/foobar) > > I want it to output: > > /tmp_dir/bar > /tmp_dir/bar/bin > /tmp_dir/bar/bin/bar > > (CPACK_RPM_BAR_COMP_PACKAGE_PREFIX = /tmp_dir/bar) > > It seems like cpack is prepending the CPACK_PACKAGING_INSTALL_PREFIX > to any relative paths before actually calling the CPackRPM.cmake > module, so by the time CPackRPM sees the paths, it is seeing > /tmp_dir/foobar/bin/bar and /tmp_dir/foobar/bin/foo, while I want it > to see /tmp_dir/bar/bin/bar and /tmp_dir/foo/bin/foo. Maybe there is > no way to achieve this currently? > What you are trying to achieve seems odd to me particularly since your rpms will be relocatable so why would you want to create the structure of /some_dir/bar_dir/bin/repeated_bar_dir instead of /bin/bar or /tmp_dir/bin/bar with either / for the first case or /tmp_dir for the second case being relocatable? Regards, Domen
-- 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: https://cmake.org/mailman/listinfo/cmake