[CMake] absolute rpath

Alexander Neundorf a.neundorf-work at gmx.net
Mon Feb 25 14:44:13 EST 2008


On Friday 22 February 2008, Jörg Becker wrote:
> On Wednesday, 20. February 2008 19:01:55 Alexander Neundorf wrote:
> > Use:
> > set_target_properties(hello PROPERTIES  INSTALL_RPATH . )
>
> This doesn't work, too. The problem may be, that I don't understand the
> path expansion in cmake (or it is buggy). I tried the following things
> (with set_target_properties its the same) using cmake 2.4.8:
>
> set( CMAKE_INSTALL_RPATH "." )  -> rpath is set to source CMAKE_SOURCE_DIR
> set( CMAKE_INSTALL_RPATH ".:." )  -> rpath is set to ".:"
> set( CMAKE_INSTALL_RPATH "foo:." )  -> rpath is set to source
> CMAKE_SOURCE_DIR/foo:.

Did you alkso try it using the target properties ?
It seemed to work here.

> > (I think usually this is not considered a good idea)
>
> Yes, but this is not in my hands. One big problem of this solution is, that
> the executable must be started from the directory, the executable lives in.
>
> My preference would be an installer which sets the correct rpath (and
> provide rpath . additionally until the installation process is accepted
> from all). Unfortunately cpack doesn't provide this (currently?).
>
> As I understand you in
> http://sourceware.org/ml/binutils/2008-01/msg00021.html you are
> searching/waiting for a similar solution, too. A difference might be that
> 'make install' (with set( CMAKE_INSTALL_RPATH ${output_dir} ) is ok for my.
> But I can neither run 'make install' nor copy my installed files (with
> rpath pointing to my path) on customer machines.

So you need your program to be executable anywhere in the file system, and it 
also has to find its shared libs ?
Would setting PATH be a alternative ? You could create automatically shell 
scripts which do that for you.

> Have you found a solution for the rpath changing problem?

Actually yes and no.
chrpath works, but it would be way better if this functionality would be 
officially in the binutils.


Alex


More information about the CMake mailing list