[CMake] CMake removes rpath from Linux binaries. How to stop

clinton at elemtech.com clinton at elemtech.com
Tue Apr 14 17:54:07 EDT 2015


----- Original Message -----

> I am trying to create a standalone build of our application on Linux. We are
> currently building on a mix of Mint 17 and Ubuntu 14.04. I have been doing a
> lot of reading about rpath, runpath and chrpath. The only way it would seem
> to get this done is to adjust the rpath via the "chrpath" tool. The issue is
> that during packaging, cmake is removing the rpath from the binaries which
> kills the process of using chrpath. I have looked at the various *_RPATH*
> cmake variables but none of the combinations seem to work correctly. CMake
> always strips the rpath from the binaries. This is with a Qt5 application
> which compiles against the Qt 5.4.1 version which is installed from the
> Qt.io website.

Have you tried only setting the INSTALL_RPATH property on the targets? 
Or setting the CMAKE_INSTALL_RPATH in your top level CMakeLists.txt file. 

For example: 

if (CMAKE_SYSTEM_NAME MATCHES "Linux" ) 

set (CMAKE_ INSTALL _RPATH "\$ORIGIN" ) 

endif () 

That alone should be enough to give you rpaths in the install tree. 

Clint 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150414/c6781b71/attachment.html>


More information about the CMake mailing list