File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11function (override_cache VAR VAL )
22 get_property (VAR_STRINGS CACHE ${VAR} PROPERTY STRINGS )
33 LIST (FIND VAR_STRINGS ${VAL} CK)
4- if (-1 EQUAL ${CK} )
4+ if (-1 EQUAL ${CK} AND DEFINED VAR_STRINGS )
55 message (SEND_ERROR
66 "\" ${VAL} \" is not valid override value for \" ${VAR} \" ."
77 " Please select value from \" ${VAR_STRINGS} \"\n " )
@@ -10,10 +10,15 @@ function(override_cache VAR VAL)
1010endfunction ()
1111
1212function (add_option NAME HELP_STRING DEFAULT VALUES )
13- # Set the default value for the option.
14- set (${NAME} ${DEFAULT} CACHE STRING ${HELP_STRING} )
15- # Set the list of allowed values for the option.
16- set_property (CACHE ${NAME} PROPERTY STRINGS ${VALUES} )
13+ if (VALUES STREQUAL "yes;no" )
14+ # Set the default value for the option.
15+ set (${NAME} ${DEFAULT} CACHE BOOL ${HELP_STRING} )
16+ else ()
17+ # Set the default value for the option.
18+ set (${NAME} ${DEFAULT} CACHE STRING ${HELP_STRING} )
19+ # Set the list of allowed values for the option.
20+ set_property (CACHE ${NAME} PROPERTY STRINGS ${VALUES} )
21+ endif ()
1722
1823 if (DEFINED ${NAME} )
1924 list (FIND VALUES ${${NAME} } IDX)
You can’t perform that action at this time.
0 commit comments