[CMake] absolute rpath

Alexander Neundorf a.neundorf-work at gmx.net
Thu Feb 28 18:18:18 EST 2008


On Wednesday 27 February 2008, Jörg Becker wrote:
> 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.

Hmm, I will try again here.

> > 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

No.
Automatically means that you can write a macro which wraps add_executable() 
and which also creates such a wrapper script.

Alex


More information about the CMake mailing list