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} ) 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? Thanks, Sam On Thu, Jan 4, 2018 at 1:51 PM, Domen Vrankar <domen.vran...@gmail.com> wrote: > 2018-01-03 22:40 GMT+01:00 Sam Lunt <sam.l...@transmarketgroup.com>: >> >> I am trying to set a per-component value for >> CPACK_PACKAGING_INSTALL_PREFIX when using the RPM generator, but I >> haven't been able to do so. >> >> I would like to be able to: >> 1. Install using "make install" (or cmake --build ${BUILD_DIR} >> --target install) and have CMAKE_INSTALL_PREFIX control the install >> location >> 2. Generate an rpm file for each component such that the rpm is >> relocatable (i.e. --prefix and --relocate are supported) and each >> component has a different default installation location >> >> The documentation for CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX seems to >> indicate that it is the correct way to set a per-component install >> prefix, since it says that CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX "May >> be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for >> relocatable RPM packages." However, I am only able to successfully use >> this if I provide an absolute path to the install command, but that >> inhibits the use of CMAKE_INSTALL_PREFIX. > > > How about using CPACK_RPM_RELOCATION_PATHS? > https://cmake.org/cmake/help/v3.10/module/CPackRPM.html#variable:CPACK_RPM_RELOCATION_PATHS > > install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/some_dir COMPONENT > libraries) > set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}" > "${CMAKE_INSTALL_LIBDIR}") > > You specify all the relocation paths for all components and if one or more > of them are found during package generation that path is written to the > package as a relocation path. > You can also use > https://cmake.org/cmake/help/v3.10/module/CPackRPM.html#variable:CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION > to discard CPACK_PACKAGING_INSTALL_PREFIX as a relocation path. > > This feature can also (is prefered to) be used in combination with > GNUInstallDirs module > (https://cmake.org/cmake/help/v3.10/module/GNUInstallDirs.html?highlight=gnuinstalldirs): > > include(GNUInstallDirs) > > 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