string(REGEX MATCH): Restore reporting of matches with semicolons

This was broken by refactoring in commit dab5e6ebb1 (introduce
cm::CMakeString class as helper for string() command, 2025-10-06,
v4.3.0-rc1~510^2~2).

Fixes: #27749
This commit is contained in:
Marc Chevrier
2026-04-13 11:32:18 -04:00
committed by Brad King
parent cba931b844
commit b24c60325a
3 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -96,7 +96,7 @@ cmList CMakeString::Match(std::string const& matchExpression,
if (makefile) {
makefile->StoreMatches(re);
}
output = re.match();
output.push_back(re.match());
}
} else {
unsigned optAnchor = 0;
+15
View File
@@ -0,0 +1,15 @@
cmake_policy(SET CMP0186 NEW)
function(check_output name expected)
set(output "${${name}}")
if(NOT output STREQUAL expected)
message(FATAL_ERROR "\"string(REGEX)\" set ${name} to \"${output}\", expected \"${expected}\"")
endif()
endfunction()
string(REGEX MATCH ".*" out "abcd;")
check_output(out "abcd;")
string(REGEX MATCHALL "^.*" out "abcd;")
check_output(out "abcd;")
+1
View File
@@ -42,6 +42,7 @@ run_cmake(UuidMissingNameValue)
run_cmake(UuidMissingTypeValue)
run_cmake(UuidBadType)
run_cmake(RegexMatch)
run_cmake(RegexClear)
run_cmake(RegexMultiMatchClear)
run_cmake(RegexEmptyMatch)