Files
CMake/Help/policy/CMP0159.rst
Brad King ad3c2c0b03 Help: Normalize and consolidate standard policy advice paragraph
Every policy's documentation has a paragraph on what version of CMake
introduced it, how to set the policy, and whether CMake warns if the
policy is not set.  The wording of this paragraph has diverged across
policies over time.  Factor the paragraph out into a standard advice
document included by every policy.
2024-01-11 14:48:01 -05:00

24 lines
915 B
ReStructuredText

CMP0159
-------
.. versionadded:: 3.29
:command:`file(STRINGS)` with ``REGEX`` updates :variable:`CMAKE_MATCH_<n>`.
In CMake 3.28 and below the :command:`file(STRINGS)` command's ``REGEX``
option does not affect :variable:`CMAKE_MATCH_<n>` variables. CMake 3.29
and above prefer to update the :variable:`CMAKE_MATCH_<n>` variables using
captures from the last match in the file, similar to the
:command:`string(REGEX MATCHALL)` command. This policy provides
compatibility for projects that have not been updated to expect the behavior.
The ``OLD`` behavior for this policy is for :command:`file(STRINGS)` with
``REGEX`` to not store capture groups in :variable:`CMAKE_MATCH_<n>`
variables. The ``NEW`` behavior is to store the capture groups.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.29
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt