On 08/07/2010 03:41 PM, Alexander Neundorf wrote: > # Call the function, if the keyword is present the value(s) following it will > # be returned in _FAIL_MESSAFE/_VERSION_VAR/_REQUIRED_VARS: > FPHSA_GET_OPTION_VALUE("FAIL_MESSAGE" _FAIL_MESSAGE ALL_ARGS _KEYWORDS FALSE) > FPHSA_GET_OPTION_VALUE("VERSION_VAR" _VERSION_VAR ALL_ARGS _KEYWORDS FALSE) > FPHSA_GET_OPTION_VALUE("REQUIRED_VARS" _REQUIRED_VARS ALL_ARGS _KEYWORDS TRUE)
I think a better name would be something like "cmake_get_keyword_argument". This interface requires the same argument lists to be traversed many times. I think we should be using a macro like PARSE_ARGUMENTS from Boost's CMake build system (see below). This is its interface documentation: # The PARSE_ARGUMENTS macro will take the arguments of another macro and # define several variables. The first argument to PARSE_ARGUMENTS is a # prefix to put on all variables it creates. The second argument is a # list of names, and the third argument is a list of options. Both of # these lists should be quoted. The rest of PARSE_ARGUMENTS are # arguments from another macro to be parsed. # # PARSE_ARGUMENTS(prefix arg_names options arg1 arg2...) # # For each item in options, PARSE_ARGUMENTS will create a variable with # that name, prefixed with prefix_. So, for example, if prefix is # MY_MACRO and options is OPTION1;OPTION2, then PARSE_ARGUMENTS will # create the variables MY_MACRO_OPTION1 and MY_MACRO_OPTION2. These # variables will be set to true if the option exists in the command line # or false otherwise. # # For each item in arg_names, PARSE_ARGUMENTS will create a variable # with that name, prefixed with prefix_. Each variable will be filled # with the arguments that occur after the given arg_name is encountered # up to the next arg_name or the end of the arguments. All options are # removed from these lists. PARSE_ARGUMENTS also creates a # prefix_DEFAULT_ARGS variable containing the list of all arguments up # to the first arg_name encountered. It should be possible to implement this with one pass over "arg_names", one pass over "options", and one pass over the rest of the arguments. I think a better name would be "cmake_parse_keyword_arguments". -Brad _______________________________________________ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers