CMP0053.rst 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 ``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. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.1
  37. .. |WARNS_OR_DOES_NOT_WARN| replace:: warns
  38. .. include:: STANDARD_ADVICE.txt
  39. .. include:: DEPRECATED.txt