Skip to content

Commit f9e79b5

Browse files
committed
Add ignored cmake modules #1301
1 parent a14abfa commit f9e79b5

10 files changed

+2493
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# This module defines the ARGUMENT_PARSER macro for parsing macro arguments.
2+
3+
# ARGUMENT_PARSER Macro
4+
# This macro parses a mixed list of arguments and headers into lists and boolean
5+
# variables. The output lists and boolean variables are stored using
6+
# tolower( header ) variable names. All non-header arguments will be added to
7+
# the output list that corresponds to the header that they follow (or to the
8+
# default list if no header has been parsed yet). If a boolean header is passed,
9+
# then its corresponding output variable is set to YES.
10+
#
11+
# Usage:
12+
# ARGUMENT_PARSER( default_list lists bools ARGN )
13+
#
14+
# Parameters:
15+
# default_list The name of the variable that list values should be added
16+
# to before any list headers have been reached. You may
17+
# pass "" to disregard premature list values.
18+
# lists The list headers (semicolon-separated string).
19+
# bools The boolean headers (semicolon-separated string).
20+
# ARGN The arguments to parse.
21+
MACRO( ARGUMENT_PARSER default_list lists bools )
22+
23+
# Start using the default list.
24+
SET( dest "${default_list}" )
25+
IF( NOT dest )
26+
SET( dest tmp )
27+
ENDIF( NOT dest )
28+
29+
# Clear all of the lists.
30+
FOREACH( list_itr ${lists} )
31+
STRING( TOLOWER ${list_itr} lower )
32+
SET( ${lower} "" )
33+
ENDFOREACH( list_itr )
34+
35+
# Set all boolean variables to NO.
36+
FOREACH( bool_itr ${bools} )
37+
STRING( TOLOWER ${bool_itr} lower )
38+
SET( ${lower} NO )
39+
ENDFOREACH( bool_itr )
40+
41+
# For all arguments.
42+
FOREACH( arg_itr ${ARGN} )
43+
44+
SET( done NO )
45+
46+
# For each of the list headers, if the current argument matches a list
47+
# header, then set the destination to the header.
48+
FOREACH( list_itr ${lists} )
49+
IF( ${arg_itr} STREQUAL ${list_itr} )
50+
STRING( TOLOWER ${arg_itr} lower )
51+
SET( dest ${lower} )
52+
SET( done YES )
53+
ENDIF( ${arg_itr} STREQUAL ${list_itr} )
54+
ENDFOREACH( list_itr )
55+
56+
# For each of the boolean headers, if the current argument matches a
57+
# boolean header, then set the boolean variable to true.
58+
FOREACH( bool_itr ${bools} )
59+
IF( ${arg_itr} STREQUAL ${bool_itr} )
60+
STRING( TOLOWER ${arg_itr} lower )
61+
SET( ${lower} YES )
62+
SET( done YES )
63+
ENDIF( ${arg_itr} STREQUAL ${bool_itr} )
64+
ENDFOREACH( bool_itr )
65+
66+
# If the current argument is not a header, then add it to the current
67+
# destination list.
68+
IF( NOT done )
69+
SET( ${dest} ${${dest}} ${arg_itr} )
70+
ENDIF( NOT done )
71+
72+
ENDFOREACH( arg_itr )
73+
74+
ENDMACRO( ARGUMENT_PARSER )

0 commit comments

Comments
 (0)