[CMake] Adding (not replacing) $ORIGIN to automatic build rpath

Daniel Schepler dschepler at scalable-networks.com
Wed Jun 25 14:34:13 EDT 2014


First, the background on why I want this: Our product uses a licensing library that creates a .so file alongside the executable, and at runtime does a dlopen() on that .so file.  But it doesn't use a full path, so we need to put $ORIGIN into the RPATH or users will have to set LD_LIBRARY_PATH to the directory containing the executable.  We don't have access to change the library to pass a full path to dlopen(), either.  But we link against some other external libraries which might not be in the system path (e.g. the MariaDB LGPL'd client library which isn't currently available as a Debian package).

So, setting properties INSTALL_RPATH "\$ORIGIN" and BUILD_WITH_INSTALL_RPATH won't work because that will replace the automatically determined rpath entirely with $ORIGIN.    Is there any way to tell CMake to combine the two just for the build version?  (The installed version will put non-system libraries into a self-contained bundle so we'll still want $ORIGIN as the RPATH there.)  I haven't found any setting that will do this by scanning the rpath-related CMake variables or target properties.
--
Daniel Schepler

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140625/1f11ef99/attachment.html>


More information about the CMake mailing list