summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake
diff options
context:
space:
mode:
authorMateusz Janek <stryku2393@gmail.com>2019-08-08 19:39:52 (GMT)
committerMateusz Janek <stryku2393@gmail.com>2019-08-16 12:55:47 (GMT)
commitbb6e95ca6d31829f8ed03512f447e8c02ea46c43 (patch)
tree7ccd6822d08c93a0b97232ae914f89b277f4ee0e /Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake
parent6f1781c63ad58c3c84987dce7eee36668ed2ba57 (diff)
downloadCMake-bb6e95ca6d31829f8ed03512f447e8c02ea46c43.zip
CMake-bb6e95ca6d31829f8ed03512f447e8c02ea46c43.tar.gz
CMake-bb6e95ca6d31829f8ed03512f447e8c02ea46c43.tar.bz2
source_group: Improved generated filters tests
Diffstat (limited to 'Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake')
-rw-r--r--Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake35
1 files changed, 35 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake
new file mode 100644
index 0000000..c82a66e
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake
@@ -0,0 +1,35 @@
+function(find_source_group LINES NAME)
+ set(foundFileFilter 0)
+ set(foundFilter 0)
+ foreach(line IN LISTS LINES)
+ if(line MATCHES "<Filter>${NAME}</Filter>")
+ if(foundFileFilter)
+ set(RunCMake_TEST_FAILED "Multiple files listed with filter for ${NAME}." PARENT_SCOPE)
+ set(FILTER_FOUND 0 PARENT_SCOPE)
+ return()
+ endif()
+ set(foundFileFilter 1)
+ endif()
+ if(line MATCHES "<Filter.*Include=\"${NAME}\"")
+ if(foundFilter)
+ set(RunCMake_TEST_FAILED "Multiple copies of ${NAME} filter listed." PARENT_SCOPE)
+ set(FILTER_FOUND 0 PARENT_SCOPE)
+ return()
+ endif()
+ set(foundFilter 1)
+ endif()
+ endforeach()
+
+ if(NOT foundFileFilter)
+ set(RunCMake_TEST_FAILED "File filter for ${NAME} not found." PARENT_SCOPE)
+ set(FILTER_FOUND 0 PARENT_SCOPE)
+ return()
+ endif()
+ if(NOT foundFilter)
+ set(RunCMake_TEST_FAILED "Filter ${NAME} not found." PARENT_SCOPE)
+ set(FILTER_FOUND 0 PARENT_SCOPE)
+ return()
+ endif()
+
+ set(FILTER_FOUND 1 PARENT_SCOPE)
+endfunction()