<div dir="ltr">2018-01-04 22:42 GMT+01:00 Sam Lunt <span dir="ltr"><<a href="mailto:sam.lunt@transmarketgroup.com" target="_blank">sam.lunt@transmarketgroup.com</a>></span>:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Domen,<br>
<br>
Thanks for the reply, but that doesn't seem to work for me. I modified<br>
my example to add this function call:<br>
<br>
list(APPEND CPACK_RPM_RELOCATION_PATHS<br>
${CPACK_PACKAGING_INSTALL_<wbr>PREFIX}<br>
)<br></blockquote><div><br></div><div>The documentation states that CPACK_PACKAGING_INSTALL_<wbr>PREFIX is prepended so the way you are using it not how it is supposed to be used.</div><div><br></div><div>With your example above I'd do something like this:</div><div><br></div><div>include(GNUInstallDirs)<br>
install(TARGETS foo<br>
DESTINATION "${CMAKE_INSTALL_BINDIR}"<br>
COMPONENT Foo_Comp<br>
)<br>
<br>
install(TARGETS bar<br>
DESTINATION "a/b/c"<br>
COMPONENT Bar_Comp<br>
)</div><div><br></div><div>list(APPEND CPACK_RPM_RELOCATION_PATHS<br>
"${CMAKE_INSTALL_BINDIR}" "a/b/c"<br>
)</div><div><br></div><div>set(CPACK_PACKAGING_INSTALL_<wbr>PREFIX "/")</div><div><br></div><div>This will make "/", "/${CMAKE_INSTALL_BINDIR}" and "/a/b/c" relocatable (and if you want to skip / just set <span class="gmail-classifier">CPACK_PACKAGING_INSTALL_PREFIX)</span>.<br></div><div><br></div><div>There was a bug in older versions of CPack that CPACK_PACKAGING_INSTALL_<wbr>PREFIX could not be set to / (it was fixed by this commit <a href="https://gitlab.kitware.com/cmake/cmake/merge_requests/583/diffs">https://gitlab.kitware.com/cmake/cmake/merge_requests/583/diffs</a> in CMake 3.9 so you can backport it if you want to as it is a small change to CPackRPM.cmake file).<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
that silences the warnings, but it still prepends the<br>
CPACK_PACKAGING_INSTALL_PREFIX when generating the RPM files, while I<br>
want it to prepend CPACK_RPM_<COMPONENT>_PACKAGE_<wbr>PREFIX.<br>
<br>
So if I call "rpm -qlp FooBar-0.1.0-Linux-Bar_Comp.<wbr>rpm", it outputs:<br>
/tmp_dir/foobar<br>
/tmp_dir/foobar/bin<br>
/tmp_dir/foobar/bin/bar<br>
<br>
(CPACK_PACKAGING_INSTALL_<wbr>PREFIX = /tmp_dir/foobar)<br>
<br>
I want it to output:<br>
<br>
/tmp_dir/bar<br>
/tmp_dir/bar/bin<br>
/tmp_dir/bar/bin/bar<br>
<br>
(CPACK_RPM_BAR_COMP_PACKAGE_<wbr>PREFIX = /tmp_dir/bar)<br>
<br>
It seems like cpack is prepending the CPACK_PACKAGING_INSTALL_PREFIX<br>
to any relative paths before actually calling the CPackRPM.cmake<br>
module, so by the time CPackRPM sees the paths, it is seeing<br>
/tmp_dir/foobar/bin/bar and /tmp_dir/foobar/bin/foo, while I want it<br>
to see /tmp_dir/bar/bin/bar and /tmp_dir/foo/bin/foo. Maybe there is<br>
no way to achieve this currently?<br></blockquote><div><br></div><div>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?</div><div><br></div><div>Regards,</div><div>Domen<br></div></div></div></div>