2018-01-03 22:40 GMT+01:00 Sam Lunt <[email protected]>: > 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
