diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2022-08-25 13:14:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-08-25 13:14:21 (GMT) |
commit | 2ef64745c89c13fdb0a66b85cff5ae17a9e3cda3 (patch) | |
tree | ede3d9e3ef2f6dc3809010fe53046c70b1af5bec /Tests/RunCMake/VS10Project | |
parent | 9d1ecd72fb45af722da7668d0c7482b7a0b1876f (diff) | |
parent | 970052feddcb49f52b49e04a9edd7cb5e9085859 (diff) | |
download | CMake-2ef64745c89c13fdb0a66b85cff5ae17a9e3cda3.zip CMake-2ef64745c89c13fdb0a66b85cff5ae17a9e3cda3.tar.gz CMake-2ef64745c89c13fdb0a66b85cff5ae17a9e3cda3.tar.bz2 |
Merge topic 'file-set-source-group'
970052fedd FILE_SET: Fix source group detection
bcc3965813 Tests: Fix VS10Project SourceGroupTreeCMakeLists check
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7609
Diffstat (limited to 'Tests/RunCMake/VS10Project')
5 files changed, 22 insertions, 4 deletions
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index ee8821a..e540b9f 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -16,6 +16,7 @@ run_cmake(NoImpLib) run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) run_cmake(SourceGroupTreeCMakeLists) +run_cmake(SourceGroupFileSet) run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) diff --git a/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake new file mode 100644 index 0000000..fb2eecc --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupFileSet-check.cmake @@ -0,0 +1,13 @@ +cmake_policy(SET CMP0011 NEW) + +set(vcFiltersFile "${RunCMake_TEST_BINARY_DIR}/SourceGroupFileSet.vcxproj.filters") +if(NOT EXISTS "${vcFiltersFile}") + set(RunCMake_TEST_FAILED "Filters file ${vcFiltersFile} does not exist.") + return() +endif() + +file(STRINGS "${vcFiltersFile}" lines) + +include(${RunCMake_TEST_SOURCE_DIR}/SourceGroupHelpers.cmake) + +find_source_group("${lines}" "Header Files\\SourceGroupFileSet") diff --git a/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake b/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake new file mode 100644 index 0000000..9541687 --- /dev/null +++ b/Tests/RunCMake/VS10Project/SourceGroupFileSet.cmake @@ -0,0 +1,3 @@ +add_library(SourceGroupFileSet INTERFACE) +target_sources(SourceGroupFileSet PUBLIC FILE_SET HEADERS FILES iface.h) +source_group("Header Files/SourceGroupFileSet" FILES iface.h) diff --git a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake index c82a66e..3a5d2e7 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupHelpers.cmake @@ -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) diff --git a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake index ee0c412..28d0d29 100644 --- a/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake +++ b/Tests/RunCMake/VS10Project/SourceGroupTreeCMakeLists-check.cmake @@ -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() |