mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
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:
@@ -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;
|
||||
|
||||
@@ -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;")
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user