summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GenEx-LIST/SUBLIST.cmake.in
blob: 9fcb6d50abe5188185894359e591a8edc5dc0f56 (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
32

include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
unset (errors)

set(listvar a b c d)

list(SUBLIST listvar 1 2 reference)
set (output "$<LIST:SUBLIST,a;b;c;d,1,2>")
if (NOT output STREQUAL reference)
  list (APPEND errors "returns bad value: ${output}")
endif()

list(SUBLIST listvar 1 -1 reference)
set (output "$<LIST:SUBLIST,a;b;c;d,1,-1>")
if (NOT output STREQUAL reference)
  list (APPEND errors "returns bad value: ${output}")
endif()

list(SUBLIST listvar 1 0 reference)
set (output "$<LIST:SUBLIST,a;b;c;d,1,0>")
if (NOT output STREQUAL reference)
  list (APPEND errors "returns bad value: ${output}")
endif()

list(SUBLIST listvar 1 5 reference)
set (output "$<LIST:SUBLIST,a;b;c;d,1,5>")
if (NOT output STREQUAL reference)
  list (APPEND errors "returns bad value: ${output}")
endif()


check_errors("LIST:SUBLIST..." ${errors})