Automatically setting the RPATH - make use of $ORIGIN ?
Stephen Kelly
steveire at gmail.com
Sat Feb 23 12:38:55 UTC 2013
Alexander Neundorf wrote:
> Hi,
>
> in kdelibs4 and, when using FindKF5.cmake, we set the RPATH automatically
> by using the cmake target property INSTALL_RPATH_USE_LINK_PATH, and
> additionally we add ${LIB_INSTALL_DIR} if it is not a system library
> directory.
>
> This means we set a bunch of absolute directories as RPATH.
> RPATH supports $ORIGIN, which seems to refer to the location of the
> current ELF file.
> Using $ORIGIN ELF files can be made, at least in this regard, relocatable.
> When using INSTALL_RPATH_USE_LINK_PATH, cmake sets all paths to already
> installed libraries. It does not add the path to shared libraries from the
> current installation, that's why we add LIB_INSTALL_DIR.
>
> So we could use $ORIGIN in shared libraries we install (so they find other
> shared libs in the same directory), $ORIGIN/../ in plugins and
> $ORIGIN/../lib/ in executables (not completely correct, but it should show
> the idea).
>
> But now that we don't have kde4_add_executable(), kde4_add_library() and
> kde4_add_plugin() anymore, we cannot easily do this.
>
> Should I try to get this into cmake, so it makes use of $ORIGIN when
> suitable ?
Can this suitability be determined in cmake, or would it be a user option? I
think it's at least worth raising on the cmake list.
> Or should we leave it to the developers to set RPATH that way ?
> Or do we want to keep those macros ?
>
> Alex
>
> (... I guess I know the answer. but won't that make us require new
> versions of cmake quite often ?)
Assuming you mean the first option, why would it make us require new
versions of cmake often?
Thanks,
Steve.
More information about the Kde-buildsystem
mailing list