[CMake] Is INSTALL_RPATH Meant to be Relative to CMAKE_INSTALL_PREFIX?

Alexander Neundorf a.neundorf-work at gmx.net
Tue Feb 5 15:29:45 EST 2013


On Tuesday 05 February 2013, David Narvaez wrote:
> On Tue, Feb 5, 2013 at 1:15 PM, Alexander Neundorf
> 
> <a.neundorf-work at gmx.net> wrote:
> > I know this was the case at some point in I think the frameworks branch
> > of kdelibs, but this was wrong, and I think it has been fixed.
> > Or where did you see this ?
> 
> I'm currently using KDE 4.10 RC 2 and, as far as I understand (I'm not
> a CMake expert), the situation is as follows:
> 
> 1. LIB_INSTALL_DIR is set to "lib"
> 2. FindKDE4Internal.cmake is called
> 3. There's a call to _set_fancy(LIB_INSTALL_DIR ...) which would have
> set the LIB_INSTALL_DIR path to an absolute path, but this variable
> was already set so it is not overridden
> 4. There's another call to set(INSTALL_RPATH "${LIB_INSTALL_DIR}")
> which, at that point, is relative
> 5. Library's RPATH eventually contains a relative path
> 
> > The install rpath must be an absolute path, or if you want it to be
> > relative
> > to the location of the ELF file, use $ORIGIN to refer to this location,
> > e.g
> > $ORIGIN/../lib/
> 
> I see, so what would you recommend from the workflow above? Set
> LIB_INSTALL_DIR to a prefixed path? Add checks in
> FindKDE4Internal.cmake before setting  INSTALL_RPATH?

I just checked.
FindKDE4Internal.cmake in the KDE/4.10 branch has the following code:

...
if (WIN32)
...
else(WIN32)
...
   _set_fancy(LIB_INSTALL_DIR  "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" ...)
...


So when building kdelibs, you should get an absolute LIB_INSTALL_DIR.
When installing kdelibs then, it will again make sure that LIB_INSTALL_DIR is 
absolute.

What exactly are you building ?
Is LIB_INSTALL_DIR preset somewhere ?

Alex


More information about the CMake mailing list