[CMake] What is a good way to exclude default library locations from install-tree rpaths?

Alexander Neundorf a.neundorf-work at gmx.net
Tue Feb 2 15:23:03 EST 2010


On Friday 29 January 2010, Alan W. Irwin wrote:
> If target_link_libraries is given the full path to an external library,
> then by default CMake uses rpath on Linux so that library is found at run
> time for the build tree.  For PLplot I have adjusted the RPATH options so
> that the install-tree rpath is similarly well determined for all our
> external libraries.
>
> However, there is one difference between the build-tree rpaths handled
> automatically by CMake and our install-tree rpaths that I would like to
> address.  CMake is smart enough so that standard
> locations (e.g., /usr/lib) which are automatically searched in any case by
> the run-time loader are filtered out of the build-tree rpaths.

> Currently, I don't have any functionality for removing standard locations
> from the install-tree rpaths.  Therefore, I am getting the following
> results from the install:
>
> -- Set runtime path of
> "/home/software/plplot_svn/installcmake/lib/libplplotd.so .9.7.0" to
> "/home/software/plplot_svn/installcmake/lib:/usr/lib:/home/software/qhull/i
>nstall/lib"

So /usr/lib doesn't appear in the build tree RPATH, but it does in the install 
RPATH ? 
I think cmake uses the CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES variable, 
which is set in UnixPaths.cmake

Which of the following two modes are you using ?
- explicitely specify the RPATH you want to have (wouldn't that work if it 
just for the libs you installed yourself, so you know the install 
locations ?)
- let cmake automatically compute the full RPATH by enabling the target 
property INSTALL_RPATH_USE_LINK_PATH


Alex


More information about the CMake mailing list