From bb6e95ca6d31829f8ed03512f447e8c02ea46c43 Mon Sep 17 00:00:00 2001 From: Mateusz Janek Date: Thu, 8 Aug 2019 21:39:52 +0200 Subject: source_group: Improved generated filters tests --- .../VS10Project/Dir/DirNested/foo_nested.cpp | 3 ++ Tests/RunCMake/VS10Project/Dir/foo.cpp | 3 ++ .../Prefixed/PrefixedNested/bar_nested.cpp | 3 ++ Tests/RunCMake/VS10Project/Prefixed/bar.cpp | 3 ++ Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 + .../VS10Project/SourceGroupCMakeLists-check.cmake | 30 +++---------------- .../RunCMake/VS10Project/SourceGroupHelpers.cmake | 35 ++++++++++++++++++++++ .../SourceGroupTreeCMakeLists-check.cmake | 25 ++++++++++++++++ .../VS10Project/SourceGroupTreeCMakeLists.cmake | 16 ++++++++++ 9 files changed, 93 insertions(+), 26 deletions(-) create mode 100644 Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp create mode 100644 Tests/RunCMake/VS10Project/Dir/foo.cpp create mode 100644 Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp create mode 100644 Tests/RunCMake/VS10Project/Prefixed/bar.cpp create mode 100644 Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake create mode 100644 Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake create mode 100644 Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists.cmake diff --git a/Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp b/Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10Project/Dir/DirNested/foo_nested.cpp @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/VS10Project/Dir/foo.cpp b/Tests/RunCMake/VS10Project/Dir/foo.cpp new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10Project/Dir/foo.cpp @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp b/Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/VS10Project/Prefixed/PrefixedNested/bar_nested.cpp @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/VS10Project/Prefixed/bar.cpp b/Tests/RunCMake/VS10Project/Prefixed/bar.cpp new file mode 100644 index 0000000..b72a1a5 --- /dev/null +++ b/Tests/RunCMake/VS10Project/Prefixed/bar.cpp @@ -0,0 +1,3 @@ +void bar() +{ +} diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 1cb4ce5..5ca069a 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -5,6 +5,7 @@ run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) +run_cmake(SourceGroupTreeCMakeLists) run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) diff --git a/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake index c2a94bb..616f38b 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupCMakeLists-check.cmake @@ -4,30 +4,8 @@ if(NOT EXISTS "${vcFiltersFile}") return() endif() -set(foundFileFilter 0) -set(foundFilter 0) file(STRINGS "${vcFiltersFile}" lines) -foreach(line IN LISTS lines) - if(line MATCHES "CMakeListsSourceGroup") - set(rule "${CMAKE_MATCH_1}") - if(foundFileFilter) - set(RunCMake_TEST_FAILED "Multiple files listed with filter for CMakeListsSourceGroup.") - return() - endif() - set(foundFileFilter 1) - endif() - if(line MATCHES "${NAME}") + 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 "