CMP0053.rst 2.1 KB

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