[CMake] Relink during install to get correct rpath in the binary?

Brad King brad.king at kitware.com
Tue Nov 22 11:42:16 EST 2005


Chris Scharver wrote:
> On 11/20/05, Brad King <brad.king at kitware.com> wrote:
> 
>>The rpath feature of CMake is intended to help developers use projects
>>with shared libraries from the build tree without setting
>>LD_LIBRARY_PATH or their platform's equivalent.  Many linux/unix people
>>consider rpaths evil for installed programs, and many linux
>>distributions ban them altogether.  The idea is that installed shared
>>libraries should be in the system's shared library search path
>>(ld.so.conf or equivalent) so they can be shared among applications.
> 
> 
> So how exactly does this get handled on Mac OS X with install_name?
> I've tried setting the variable so that CMAKE_SKIP_RPATH is OFF, but I
> still get libraries with build library locations embedded in them
> rather than the INSTALL_PREFIX. Is extra work required when writing
> the CMakeLists.txt in order to get CMake to use the correct
> install_name?

Use of install_name for rpath was altered in CMake 2.2.  Make sure you 
are using CMake 2.2 and not 2.0.  After setting CMAKE_SKIP_RPATH to ON 
delete the libraries from the build tree to make sure they relink with 
the new install_name.  Then the install_name should be set to just the 
name of the library with no path.

-Brad


More information about the CMake mailing list