KDE/kdelibs

Brad King brad.king at kitware.com
Wed Mar 8 22:17:12 CET 2006


Alexander Neundorf wrote:
> On Wednesday 08 March 2006 15:23, Brad King wrote:
>>OSX does not have RPATHs.  You will need to use the INSTALL_NAME_DIR
>>target property on the shared libraries to get this working.
> 
> How does INSTALL_NAME_DIR work ? The same as RPATH ? Is it also a list of 
> directories ? If it is used on e.g. libDCOP.dylib, how does this help 
> dcopidl2ccp in finding libDCOP.dylib ?

It sets the directory portion of the "install_name" of a shared library. 
  This stores for example in libDCOP.dylib the full path to the library. 
  When dcopidl2cpp links to the library it copies this full path as a 
library to load.  At runtime the dynamic loader searches for the 
libraries using the "install_name"s stored in the executable, one for 
each library.  If the install_name is a full path then it is used 
directly.  If it is a relative path it is searched relative to each 
entry of DYLD_LIBRARY_PATH.  It may also contain a keyword like 
"@executable_path/../lib/libDCOP.dylib".

CMake by default sets the install_name of a library in the build tree to 
be the full path to its build tree location.  When installing targets 
CMake uses the command "install_name_tool" to change the directory part 
(not the filename) of the install_name of each target to that specified 
by the target's INSTALL_NAME_DIR target property.  For each library that 
an executable links it also changes the executable's copy of that 
library's install_name so that it may be found in the installed location.

Basically you just have to set the INSTALL_NAME_DIR target property of a 
library to the install-tree location of that library.  If all the KDE 
libraries install to the same place then you can just set 
CMAKE_INSTALL_NAME_DIR to that location at the top of the tree and 
everything will just work.  Thanks to install_name_tool no relinking is 
needed between the built and installed binaries.

-Brad


More information about the Kde-buildsystem mailing list