CMP0053.rst 2.1 KB

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