CMP0159 — CMake 4.0.1 Documentation (original) (raw)

Added in version 3.29.

file(STRINGS) with REGEX updates CMAKE_MATCH_.

In CMake 3.28 and below the file(STRINGS) command's REGEXoption does not affect CMAKE_MATCH_ variables. CMake 3.29 and above prefer to update the CMAKE_MATCH_ variables using captures from the last match in the file, similar to thestring(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 file(STRINGS) withREGEX to not store capture groups in CMAKE_MATCH_variables. The NEW behavior is to store the capture groups.

This policy was introduced in CMake version 3.29. It may be set by cmake_policy() or cmake_minimum_required(). If it is not set, CMake does not warn, and uses OLD behavior.

Note

The OLD behavior of a policy isdeprecated by definitionand may be removed in a future version of CMake.