mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 12:49:36 -06:00
Tests: Fix VS10Project SourceGroupTreeCMakeLists check
Fix an `IN LISTS` loop, fix a variable check, and escape backslashes in the regex used to search for source group names.
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
function(find_source_group LINES NAME)
|
||||
set(foundFileFilter 0)
|
||||
set(foundFilter 0)
|
||||
string(REPLACE "\\" "\\\\" regexName "${NAME}")
|
||||
foreach(line IN LISTS LINES)
|
||||
if(line MATCHES "<Filter>${NAME}</Filter>")
|
||||
if(line MATCHES "<Filter>${regexName}</Filter>")
|
||||
if(foundFileFilter)
|
||||
set(RunCMake_TEST_FAILED "Multiple files listed with filter for ${NAME}." PARENT_SCOPE)
|
||||
set(FILTER_FOUND 0 PARENT_SCOPE)
|
||||
@@ -10,7 +11,7 @@ function(find_source_group LINES NAME)
|
||||
endif()
|
||||
set(foundFileFilter 1)
|
||||
endif()
|
||||
if(line MATCHES "<Filter.*Include=\"${NAME}\"")
|
||||
if(line MATCHES "<Filter.*Include=\"${regexName}\"")
|
||||
if(foundFilter)
|
||||
set(RunCMake_TEST_FAILED "Multiple copies of ${NAME} filter listed." PARENT_SCOPE)
|
||||
set(FILTER_FOUND 0 PARENT_SCOPE)
|
||||
|
||||
@@ -18,9 +18,9 @@ set(SOURCE_GROUPS_TO_FIND
|
||||
"SourcesPrefix\\PrefixedNested"
|
||||
)
|
||||
|
||||
foreach(GROUP_NAME IN LISTS ${SOURCE_GROUPS_TO_FIND})
|
||||
foreach(GROUP_NAME IN LISTS SOURCE_GROUPS_TO_FIND)
|
||||
find_source_group("${lines}" ${GROUP_NAME})
|
||||
if(NOT ${FILTER_FOUND})
|
||||
if(NOT FILTER_FOUND)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
Reference in New Issue
Block a user