summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeTests/ListTest.cmake.in
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-08-15 14:26:50 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-08-15 14:26:50 (GMT)
commit2f23ecdb8aa5bc1a86158df551f5649c439c7c52 (patch)
treede39decb56efe7120c4e65d4012d829e95de3f66 /Tests/CMakeTests/ListTest.cmake.in
parent58b0e317847994fdce6371605161ddac70a02eb3 (diff)
downloadCMake-2f23ecdb8aa5bc1a86158df551f5649c439c7c52.zip
CMake-2f23ecdb8aa5bc1a86158df551f5649c439c7c52.tar.gz
CMake-2f23ecdb8aa5bc1a86158df551f5649c439c7c52.tar.bz2
ENH: change LIST(CONTAINS ...) TO LIST(FIND ...), which returns the index
and which is more useful, because then you can also access the item behind the one you were looking, useful for writing macros with optional keywords with parameters Alex
Diffstat (limited to 'Tests/CMakeTests/ListTest.cmake.in')
-rw-r--r--Tests/CMakeTests/ListTest.cmake.in10
1 files changed, 6 insertions, 4 deletions
diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in
index 38fea14..eea0da0 100644
--- a/Tests/CMakeTests/ListTest.cmake.in
+++ b/Tests/CMakeTests/ListTest.cmake.in
@@ -67,11 +67,13 @@ SET(result andy bill bob brad ken peter)
LIST(REMOVE_AT result 2 -1)
TEST("REMOVE_AT result 2 -1" "andy;bill;brad;ken")
-LIST(CONTAINS mylist ken result)
-TEST("CONTAINS mylist ken result" "TRUE")
+# ken is at index 2, nobody is not in the list so -1 should be returned
+SET(mylist andy bill ken brad)
+LIST(FIND mylist ken result)
+TEST("FIND mylist ken result" "2")
-LIST(CONTAINS mylist nobody result)
-TEST("CONTAINS mylist nobody result" "FALSE")
+LIST(FIND mylist nobody result)
+TEST("FIND mylist nobody result" "-1")
SET(result ken bill andy brad)
LIST(SORT result)