cmake and RPATH

Brad King brad.king at kitware.com
Thu Feb 16 16:52:30 CET 2006


Thiago Macieira wrote:
> Brad King wrote:
> 
>>FYI, I've been working on an implementation in CMake to relink targets
>>with an install-tree RPATH before installing.  This is needed even if
>>you don't want any RPATH in the install tree to remove the RPATH that
>>points to the build tree.
> 
> Which begs the question of the default. Why does it build with an rpath of 
> the build tree?
> 
> Most KDE applications can't run before installing, due to other missing 
> stuff (kparts, icons, desktop files, rc files, etc.). I'd expect most 
> developers to be used to installing before running/testing by now.

Including an rpath pointing at the build tree has been a default in 
CMake for many years.  All of Kitware's projects run both from the build 
tree and from the install tree so it makes sense for us (and is great 
for debugging).

There is a cache entry (advanced) called CMAKE_SKIP_RPATH that if set to 
ON disables this feature and leaves an empty rpath in the build tree. 
The feature can be disabled in all of KDE by adding this to the top 
CMakeLists.txt file:

SET(CMAKE_SKIP_RPATH 1 CACHE INTERNAL "" FORCE)

which will remove the CMAKE_SKIP_RPATH from the set of options available 
to the user and leave it enabled always thus removing rpath support from 
the build tree.

The flip-side of this discussion is whether the install-tree RPATH or 
RUNPATH should be built into the build-tree targets so that relinking is 
not needed at all (but running from the build tree may use older 
already-installed libraries).  I'll see if I can make this an option in 
the CMake implementation.

-Brad


More information about the Kde-buildsystem mailing list