CMake RPATH handling: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(New page: CMake gives the user complete control over the RPATH of executables and libraries created using CMake. ==What is RPATH ?== If an executable ''foo'' links to the shared library ''bar'', t...)
 
(Replace content with link to new CMake community wiki)
 
(30 intermediate revisions by 8 users not shown)
Line 1: Line 1:
CMake gives the user complete control over the RPATH of executables and libraries created using CMake.
{{CMake/Template/Moved}}


==What is RPATH ?==
This page has moved [https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling here].
 
If an executable ''foo'' links to the shared library ''bar'', the library ''bar'' has to be found and loaded when the executable foo is executed. This is the job of the linker, under Linux this is usually ld.so.
The linker searches a set of directories for the library bar, which will under most UNIXes have the name "libbar.so".
The linker will search the libraries in the following directories in the given order:
 
* RPATH - a list of directories which is linked into the executable, supported on most UNIX systems
* LD_LIBRARY_PATH - an environment variable which holds a list of directories
* RUNPATH - same as RPATH, but searched ''after'' LD_LIBRARY_PATH, supported only on some newer UNIX systems, e.g. on most current Linux systems
* /etc/ld.so.conf - configuration file for ld.so which lists additional library directories
* builtin directories - basically /lib and /usr/lib

Latest revision as of 15:41, 30 April 2018


The CMake community Wiki has moved to the Kitware GitLab Instance.

This page has moved here.