Tests/RunCMake/string/RegexMatch.cmake
raw| 1 | |
| 2 | cmake_policy(SET CMP0186 NEW) |
| 3 | |
| 4 | function(check_output name expected) |
| 5 | set(output "${${name}}") |
| 6 | if(NOT output STREQUAL expected) |
| 7 | message(FATAL_ERROR "\"string(REGEX)\" set ${name} to \"${output}\", expected \"${expected}\"") |
| 8 | endif() |
| 9 | endfunction() |
| 10 | |
| 11 | string(REGEX MATCH ".*" out "abcd;") |
| 12 | check_output(out "abcd;") |
| 13 | |
| 14 | string(REGEX MATCHALL "^.*" out "abcd;") |
| 15 | check_output(out "abcd;") |