diff options
author | Brad King <brad.king@kitware.com> | 2021-01-13 14:20:55 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-01-13 14:21:00 (GMT) |
commit | 27c2579efd77dea8a830df1ba66cc401d282f038 (patch) | |
tree | 9be7af7fda87c77f0fc4b89c8e67298774a9a6c9 /Tests | |
parent | 00d8a1dff8e9165c1091059754fce5e99c7f12b7 (diff) | |
parent | 38e2299fc84aa31ca73bebf1efc9123dbc7bee1a (diff) | |
download | CMake-27c2579efd77dea8a830df1ba66cc401d282f038.zip CMake-27c2579efd77dea8a830df1ba66cc401d282f038.tar.gz CMake-27c2579efd77dea8a830df1ba66cc401d282f038.tar.bz2 |
Merge topic 'issue-21663'
38e2299fc8 list(REMOVE_ITEM): Make removal of an empty item a no-op.
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5693
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeTests/ListTest.cmake.in | 3 | ||||
-rw-r--r-- | Tests/RunCMake/list/REMOVE_ITEM-NoItemArg.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/list/RunCMakeTest.cmake | 1 |
3 files changed, 7 insertions, 2 deletions
diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index 785f41d..76737e5 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -142,9 +142,8 @@ set(Find-List-Only-STDERR "three") set(Insert-List-Only-STDERR "at least three") set(Length-List-Only-STDERR "two") set(Remove_At-List-Only-STDERR "at least two") -set(Remove_Item-List-Only-STDERR "two or more") -foreach(cmd IN ITEMS Find Get Insert Length Remove_At Remove_Item) +foreach(cmd IN ITEMS Find Get Insert Length Remove_At) string(TOUPPER ${cmd} cmd_upper) set(${cmd}-List-Only-RESULT 1) set(${cmd}-List-Only-STDERR ".*CMake Error at List-${cmd}-List-Only.cmake:1 \\(list\\):.*list sub-command ${cmd_upper} requires ${${cmd}-List-Only-STDERR} arguments.*") diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NoItemArg.cmake b/Tests/RunCMake/list/REMOVE_ITEM-NoItemArg.cmake new file mode 100644 index 0000000..f69c024 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_ITEM-NoItemArg.cmake @@ -0,0 +1,5 @@ +set(ls "a" "b" "c") +list(REMOVE_ITEM ls alpha) +if (NOT ls STREQUAL "a;b;c") + message(FATAL_ERROR "list(REMOVE_ITEM) modified for empty item") +endif () diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index b4a91bc..c11891c 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -30,6 +30,7 @@ run_cmake(FILTER-NotList) run_cmake(REMOVE_AT-NotList) run_cmake(REMOVE_DUPLICATES-NotList) run_cmake(REMOVE_ITEM-NotList) +run_cmake(REMOVE_ITEM-NoItemArg) run_cmake(REVERSE-NotList) run_cmake(SORT-NotList) |