[CMake] cmake end user vs. developer rpath handling

Craig Scott craig.scott at crascit.com
Wed Oct 9 06:46:16 EDT 2019


On Wed, Oct 9, 2019 at 5:24 PM Zakrzewski, Jakub <
Jakub.Zakrzewski at scheer-group.com> wrote:

>
> ________________________________________
> From: CMake <cmake-bounces at cmake.org> on behalf of DIXON, MARK C. <
> mark.c.dixon at durham.ac.uk>
> Sent: 08 October 2019 17:25
> To: cmake at cmake.org
> Subject: [CMake] cmake end user vs. developer rpath handling
>
> >Sometimes, this does the trick. When it does, I'm very happy:
> >
> >   cmake -D CMAKE_INSTALL_RPATH="/my/rpath" source_dir
> >
> >I'm currently looking at a package
> >(https://github.com/PointCloudLibrary/pcl) where this has no bearing on
> >the rpath of the installed software - I seem to get something set by the
> >developer.
>
> That "something" seems to be line 257:
> set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
>
> >Is there a way to reliably add to, or at least override, the developer's
> >rpath in any cmake-built software?
>
>
> Short of editing the build system scripts? I doubt...
>

The CMAKE_INSTALL_RPATH variable is used to initialise the INSTALL_RPATH
property of a target when that target is created. If you are pulling in
these other projects via add_subdirectory() rather than building them
standalone, you could modify the INSTALL_RPATH property of the targets you
want to change from within your own top level project after
add_subdirectory() returns.

-- 
Craig Scott
Melbourne, Australia
https://crascit.com

Get the hand-book for every CMake user: Professional CMake: A Practical
Guide <https://crascit.com/professional-cmake/>
Consulting services (CMake, C++, build/release processes):
https://crascit.com/services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20191009/f6802b97/attachment.html>


More information about the CMake mailing list