Ryan Prichard | 7aea7e9 | 2022-01-13 17:30:17 -0800 | [diff] [blame] | 1 | CMP0095 |
| 2 | ------- |
| 3 | |
| 4 | .. versionadded:: 3.16 |
| 5 | |
| 6 | ``RPATH`` entries are properly escaped in the intermediary CMake install script. |
| 7 | |
| 8 | In CMake 3.15 and earlier, ``RPATH`` entries set via |
| 9 | :variable:`CMAKE_INSTALL_RPATH` or via :prop_tgt:`INSTALL_RPATH` have not been |
| 10 | escaped before being inserted into the ``cmake_install.cmake`` script. Dynamic |
| 11 | linkers 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 |
| 14 | CMake's variable syntax. In order to not be substituted (usually to an empty |
| 15 | string) already by the intermediary ``cmake_install.cmake`` script, the user had |
| 16 | to 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 |
| 19 | and later will make sure ``RPATH`` entries are inserted literally by escaping |
| 20 | any coincidental CMake syntax. |
| 21 | |
| 22 | The ``OLD`` behavior of this policy is to not escape ``RPATH`` entries in the |
| 23 | intermediary ``cmake_install.cmake`` script. The ``NEW`` behavior is to properly |
| 24 | escape coincidental CMake syntax in ``RPATH`` entries when generating the |
| 25 | intermediary ``cmake_install.cmake`` script. |
| 26 | |
| 27 | This policy was introduced in CMake version 3.16. CMake version |release| warns |
| 28 | when 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`` |
| 30 | or ``NEW`` explicitly. |
| 31 | |
| 32 | .. include:: DEPRECATED.txt |