blob: ebdbab6f9f6746974f96a3ec9058cb49ed84dd07 [file] [log] [blame]
Ryan Prichard7aea7e92022-01-13 17:30:17 -08001CMP0095
2-------
3
4.. versionadded:: 3.16
5
6``RPATH`` entries are properly escaped in the intermediary CMake install script.
7
8In CMake 3.15 and earlier, ``RPATH`` entries set via
9:variable:`CMAKE_INSTALL_RPATH` or via :prop_tgt:`INSTALL_RPATH` have not been
10escaped before being inserted into the ``cmake_install.cmake`` script. Dynamic
11linkers on ELF-based systems (e.g. Linux and FreeBSD) allow certain keywords in
12``RPATH`` entries, such as ``${ORIGIN}`` (More details are available in the
13``ld.so`` man pages on those systems). The syntax of these keywords can match
14CMake's variable syntax. In order to not be substituted (usually to an empty
15string) already by the intermediary ``cmake_install.cmake`` script, the user had
16to double-escape such ``RPATH`` keywords, e.g.
17``set(CMAKE_INSTALL_RPATH "\\\${ORIGIN}/../lib")``. Since the intermediary
18``cmake_install.cmake`` script is an implementation detail of CMake, CMake 3.16
19and later will make sure ``RPATH`` entries are inserted literally by escaping
20any coincidental CMake syntax.
21
22The ``OLD`` behavior of this policy is to not escape ``RPATH`` entries in the
23intermediary ``cmake_install.cmake`` script. The ``NEW`` behavior is to properly
24escape coincidental CMake syntax in ``RPATH`` entries when generating the
25intermediary ``cmake_install.cmake`` script.
26
27This policy was introduced in CMake version 3.16. CMake version |release| warns
28when the policy is not set and detected usage of CMake-like syntax and uses
29``OLD`` behavior. Use the :command:`cmake_policy` command to set it to ``OLD``
30or ``NEW`` explicitly.
31
32.. include:: DEPRECATED.txt