[CMake] Relative RPATH for installation (was: LOCATION target property, generator expressions)

Brad King brad.king at kitware.com
Fri Sep 28 08:49:17 EDT 2018


On 09/27/2018 08:03 PM, Hendrik Greving wrote:
> Thanks. Ok one step back. What we want is to have the same relative path
> from binary/executable to linked library in build and install tree
> (which we assume is the same for us). Looks like by default,
> e.g. cmake 3.9, puts in an absolute path.

CMake puts in absolute RPATH values in the build tree to make things run
there.  There is a separate INSTALL_RPATH target property that can be
set to the RPATH to be used in the install tree.  Since your install
rules control the relative layout in the install tree independent of the
build tree layout, then your project code can set INSTALL_RPATH to
$ORIGIN/... as needed for wherever it installs things.

-Brad


More information about the CMake mailing list