[CMake] absolute rpath

Jörg Becker news at elke-joerg.de
Wed Feb 27 11:10:49 EST 2008


On Monday, 25. February 2008 20:44:13 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.
>
Yes, I tried it. '.' is expanded by to source dir. And also the other 
expansions are the same. If I use ".;." (cmake path delimiter) instead 
of ".:." (unix path delimiter), the resulting rpath ist 
CMAKE_SOURCE_DIR:CMAKE_SOURCE_DIR.

I'm using cmake version 2.4-patch 8 from suse backports for suse 10.3.

>
> 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 ? 
Yes, setting PATH or LD_LIBRARY_PATH in a shell wrapper is an alternative. 

> You could create automatically shell 
> scripts which do that for you.
>
Does automatically mean by CPack? The docu about CPack is quite short (Is 
there more in 'Mastering CMake'?) and I haven't played around a lot. It would 
be nice and quite generel to help all users, if CPack would provide the 
following steps on installation time:

1. find_package / install_package for external libs
2. install executeables and own libs into given path (currently working)
3. set rpath, generate a shell wrapper, make registry entries or whatever to 
ensure to find as well the external as the own libs.


Jörg


More information about the CMake mailing list