CMP0095.rst 1.5 KB

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