blob: 561f9c03b108f8f64cc5af70b12b31e0888f01b1 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
include(${CMAKE_CURRENT_LIST_DIR}/test_utils.cmake)
# No keywords that miss any values, _KEYWORDS_MISSING_VALUES should not be defined
cmake_parse_arguments(PREF "" "P1" "P2" P1 p1 P2 p2_a p2_b)
TEST(PREF_KEYWORDS_MISSING_VALUES "UNDEFINED")
# Keyword should even be deleted from the actual scope
set(PREF_KEYWORDS_MISSING_VALUES "What ever")
cmake_parse_arguments(PREF "" "" "")
TEST(PREF_KEYWORDS_MISSING_VALUES "UNDEFINED")
# Given missing keywords as only option
cmake_parse_arguments(PREF "" "P1" "P2" P1)
TEST(PREF_KEYWORDS_MISSING_VALUES "P1")
TEST(PREF_P1 "UNDEFINED")
TEST(PREF_UNPARSED_ARGUMENTS "UNDEFINED")
# Mixed with unparsed arguments
cmake_parse_arguments(UPREF "" "P1" "P2" A B P2 C P1)
TEST(UPREF_KEYWORDS_MISSING_VALUES "P1")
TEST(UPREF_UNPARSED_ARGUMENTS A B)
# one_value_keyword followed by option
cmake_parse_arguments(REF "OP" "P1" "" P1 OP)
TEST(REF_KEYWORDS_MISSING_VALUES "P1")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_OP "TRUE")
# Counter Test
cmake_parse_arguments(REF "OP" "P1" "" P1 p1 OP)
TEST(REF_KEYWORDS_MISSING_VALUES "UNDEFINED")
TEST(REF_P1 "p1")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_OP "TRUE")
# one_value_keyword followed by a one_value_keyword
cmake_parse_arguments(REF "" "P1;P2" "" P1 P2 p2)
TEST(REF_KEYWORDS_MISSING_VALUES "P1")
TEST(REF_P1 "UNDEFINED")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_P2 "p2")
# Counter Test
cmake_parse_arguments(REF "" "P1;P2" "" P1 p1 P2 p2)
TEST(REF_KEYWORDS_MISSING_VALUES "UNDEFINED")
TEST(REF_P1 "p1")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_P2 "p2")
# one_value_keyword followed by a multi_value_keywords
cmake_parse_arguments(REF "" "P1" "P2" P1 P2 p1 p2)
TEST(REF_KEYWORDS_MISSING_VALUES "P1")
TEST(REF_P1 "UNDEFINED")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_P2 p1 p2)
# Counter Examples
cmake_parse_arguments(REF "" "P1" "P2" P1 p1 P2 p1 p2)
TEST(REF_KEYWORDS_MISSING_VALUES "UNDEFINED")
TEST(REF_P1 "p1")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_P2 p1 p2)
# multi_value_keywords as only option
cmake_parse_arguments(REF "" "P1" "P2" P2)
TEST(REF_KEYWORDS_MISSING_VALUES "P2")
TEST(REF_P1 "UNDEFINED")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_P2 "UNDEFINED")
# multi_value_keywords followed by option
cmake_parse_arguments(REF "O1" "" "P1" P1 O1)
TEST(REF_KEYWORDS_MISSING_VALUES "P1")
TEST(REF_P1 "UNDEFINED")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_O1 "TRUE")
# counter test
cmake_parse_arguments(REF "O1" "" "P1" P1 p1 p2 O1)
TEST(REF_KEYWORDS_MISSING_VALUES "UNDEFINED")
TEST(REF_P1 "p1;p2")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_O1 "TRUE")
# multi_value_keywords followed by one_value_keyword
cmake_parse_arguments(REF "" "P1" "P2" P2 P1 p1)
TEST(REF_KEYWORDS_MISSING_VALUES "P2")
TEST(REF_P1 "p1")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_P2 "UNDEFINED")
# counter test
cmake_parse_arguments(REF "" "P1" "P2" P2 p2 P1 p1)
TEST(REF_KEYWORDS_MISSING_VALUES "UNDEFINED")
TEST(REF_P1 "p1")
TEST(REF_UNPARSED_ARGUMENTS "UNDEFINED")
TEST(REF_P2 "p2")
# one_value_keyword as last argument
cmake_parse_arguments(REF "" "P1" "P2" A P2 p2 P1)
TEST(REF_KEYWORDS_MISSING_VALUES "P1")
TEST(REF_P1 "UNDEFINED")
TEST(REF_UNPARSED_ARGUMENTS "A")
TEST(REF_P2 "p2")
# multi_value_keywords as last argument
cmake_parse_arguments(REF "" "P1" "P2" P1 p1 P2)
TEST(REF_KEYWORDS_MISSING_VALUES "P2")
TEST(REF_P1 "p1")
TEST(REF_P2 "UNDEFINED")
# Multiple one_value_keyword and multi_value_keywords at different places
cmake_parse_arguments(REF "O1;O2" "P1" "P2" P1 O1 P2 O2)
TEST(REF_KEYWORDS_MISSING_VALUES P1 P2)
TEST(REF_P1 "UNDEFINED")
TEST(REF_P2 "UNDEFINED")
# Duplicated missing keywords
cmake_parse_arguments(REF "O1;O2" "P1" "P2" P1 O1 P2 O2 P1 P2)
TEST(REF_KEYWORDS_MISSING_VALUES P1 P2)
TEST(REF_P1 "UNDEFINED")
TEST(REF_P2 "UNDEFINED")
# make sure keywords that are never used, don't get added to KEYWORDS_MISSING_VALUES
cmake_parse_arguments(REF "O1;O2" "P1" "P2")
TEST(REF_KEYWORDS_MISSING_VALUES "UNDEFINED")
TEST(REF_O1 FALSE)
TEST(REF_O2 FALSE)
TEST(REF_P1 UNDEFINED)
TEST(REF_P2 UNDEFINED)
|