CMP0053.rst 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. CMP0053
  2. -------
  3. .. versionadded:: 3.1
  4. Simplify variable reference and escape sequence evaluation.
  5. CMake 3.1 introduced a much faster implementation of evaluation of the
  6. :ref:`Variable References` and :ref:`Escape Sequences` documented in the
  7. :manual:`cmake-language(7)` manual. While the behavior is identical
  8. to the legacy implementation in most cases, some corner cases were
  9. cleaned up to simplify the behavior. Specifically:
  10. * Expansion of ``@VAR@`` reference syntax defined by the
  11. :command:`configure_file` and :command:`string(CONFIGURE)`
  12. commands is no longer performed in other contexts.
  13. * Literal ``${VAR}`` reference syntax may contain only
  14. alphanumeric characters (``A-Z``, ``a-z``, ``0-9``) and
  15. the characters ``_``, ``.``, ``/``, ``-``, and ``+``.
  16. Note that ``$`` is technically allowed in the ``NEW`` behavior, but is
  17. invalid for ``OLD`` behavior. This is due to an oversight during the
  18. implementation of :policy:`CMP0053` and its use as a literal variable
  19. reference is discouraged for this reason.
  20. Variables with other characters in their name may still
  21. be referenced indirectly, e.g.
  22. .. code-block:: cmake
  23. set(varname "otherwise & disallowed $ characters")
  24. message("${${varname}}")
  25. * The setting of policy :policy:`CMP0010` is not considered,
  26. so improper variable reference syntax is always an error.
  27. * More characters are allowed to be escaped in variable names.
  28. Previously, only ``()#" \@^`` were valid characters to
  29. escape. Now any non-alphanumeric, non-semicolon, non-NUL
  30. character may be escaped following the ``escape_identity``
  31. production in the :ref:`Escape Sequences` section of the
  32. :manual:`cmake-language(7)` manual.
  33. The ``OLD`` behavior for this policy is to honor the legacy behavior for
  34. variable references and escape sequences. The ``NEW`` behavior is to
  35. use the simpler variable expansion and escape sequence evaluation rules.
  36. This policy was introduced in CMake version 3.1.
  37. CMake version |release| warns when the policy is not set and uses
  38. ``OLD`` behavior. Use the :command:`cmake_policy` command to set
  39. it to ``OLD`` or ``NEW`` explicitly.
  40. .. include:: DEPRECATED.txt