<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2018-01-03 22:40 GMT+01:00 Sam Lunt <span dir="ltr"><<a href="mailto:sam.lunt@transmarketgroup.com" target="_blank">sam.lunt@transmarketgroup.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am trying to set a per-component value for<br>
CPACK_PACKAGING_INSTALL_PREFIX when using the RPM generator, but I<br>
haven't been able to do so.<br>
<br>
I would like to be able to:<br>
1. Install using "make install" (or cmake --build ${BUILD_DIR}<br>
--target install) and have CMAKE_INSTALL_PREFIX control the install<br>
location<br>
2. Generate an rpm file for each component such that the rpm is<br>
relocatable (i.e. --prefix and --relocate are supported) and each<br>
component has a different default installation location<br>
<br>
The documentation for CPACK_RPM_<COMPONENT>_PACKAGE_<wbr>PREFIX seems to<br>
indicate that it is the correct way to set a per-component install<br>
prefix, since it says that CPACK_RPM_<COMPONENT>_PACKAGE_<wbr>PREFIX "May<br>
be used to set per component CPACK_PACKAGING_INSTALL_PREFIX for<br>
relocatable RPM packages." However, I am only able to successfully use<br>
this if I provide an absolute path to the install command, but that<br>
inhibits the use of CMAKE_INSTALL_PREFIX.<br></blockquote><div><br></div><div>How about using CPACK_RPM_RELOCATION_PATHS?</div><div><a href="https://cmake.org/cmake/help/v3.10/module/CPackRPM.html#variable:CPACK_RPM_RELOCATION_PATHS">https://cmake.org/cmake/help/v3.10/module/CPackRPM.html#variable:CPACK_RPM_RELOCATION_PATHS</a><br></div><div><br></div><div>install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/some_dir COMPONENT libraries)<br></div><div>set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}"<br>  "${CMAKE_INSTALL_LIBDIR}")</div><div><br></div><div>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.<br></div><div>You can also use <a href="https://cmake.org/cmake/help/v3.10/module/CPackRPM.html#variable:CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION">https://cmake.org/cmake/help/v3.10/module/CPackRPM.html#variable:CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION</a> to discard CPACK_PACKAGING_INSTALL_PREFIX as a relocation path.</div><div><br></div><div>This feature can also (is prefered to) be used in combination with GNUInstallDirs module (<a href="https://cmake.org/cmake/help/v3.10/module/GNUInstallDirs.html?highlight=gnuinstalldirs">https://cmake.org/cmake/help/v3.10/module/GNUInstallDirs.html?highlight=gnuinstalldirs</a>):</div><div><br></div><div>include(GNUInstallDirs)<br></div><div><br></div><div>Regards,</div><div>Domen<br></div></div></div></div>