[CMake] Installed project with shared libs

Brad King brad.king at kitware.com
Thu Feb 23 18:21:18 EST 2006


Tanner Lovelace wrote:
> On 2/23/06, Brad King <brad.king at kitware.com> wrote:
> 
>>You can set CMAKE_SKIP_RPATH in the advanced cache options to disable
>>the rpaths that point at the build tree (this works with any CMake
>>version).  Then the installed libraries will not have any rpath.
>>Programs can be executed by adding their location to LD_LIBRARY_PATH.
> 
> 
> Does this actually work on OS X? (Since he stated he was using
> dylibs, which, afaik, are only on OS X or Darwin.)  AFAIK, the full path
> to the library is always included in dylibs and you can't turn it off.
> (See http://developer.apple.com/releasenotes/DeveloperTools/dyld.html
> near the bottom where it lists "no rpath support".)
> What do you do in this case?

I'm actually in the middle of implementing this now.  You can in fact 
turn it off and make the system use DYLD_LIBRARY_PATH to find it.  The 
library is created with an "install_name" which is copied into targets 
that link to it.  This name can be a full path or just a name.  If it is 
the full path then that path is used.  Otherwise the path is searched 
relative to each entry in DYLD_LIBRARY_PATH.

Currently CMake sets the install_name to the full path of the library in 
the build tree, or to just the name of the library if CMAKE_SKIP_RPATH 
is on.  I'm currently implementing changes to tweak the install_name 
when the targets are installed.

-Brad


More information about the CMake mailing list