blob: ebd7ba580e215604b50044be66e8a791fbb47200 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
cmake_policy(SET CMP0057 NEW)
set(MY_NON_EXISTENT_LIST)
set(MY_EMPTY_LIST "")
set(MY_LIST foo bar)
if(NOT "foo" IN_LIST MY_LIST)
message(FATAL_ERROR "expected item 'foo' not found in list MY_LIST")
endif()
if("baz" IN_LIST MY_LIST)
message(FATAL_ERROR "unexpected item 'baz' found in list MY_LIST")
endif()
if("foo" IN_LIST MY_NON_EXISTENT_LIST)
message(FATAL_ERROR
"unexpected item 'baz' found in non existent list MY_NON_EXISTENT_LIST")
endif()
if("foo" IN_LIST MY_EMPTY_LIST)
message(FATAL_ERROR
"unexpected item 'baz' found in empty list MY_EMPTY_LIST")
endif()
set(VAR "foo")
if(NOT VAR IN_LIST MY_LIST)
message(FATAL_ERROR "expected item VAR not found in list MY_LIST")
endif()
|