[cmake-developers] Converting cmake_parse_arguments to a builtin command

Brad King brad.king at kitware.com
Fri Dec 6 15:42:49 EST 2013


On 12/06/2013 03:11 PM, Matthew Woehlke wrote:
> On 2013-12-06 14:51, Daniele E. Domenichelli wrote:
>> Are you sure you don't want the command to be renamed to
>> "parse_arguments"? The only commands containing "cmake" looks strictly
>> related to "cmake", and the arguments parsing does not look that much
>> related...
> 
> FWIW, I was sort-of hoping it would be. If so, CMakeParseArguments.cmake 
> can be left with a simple stub to call the new version.
> 
> As a bonus, the new version could itself take named arguments instead of 
> positional with a flag whether or not to skip empty (default = keep) 
> with the compatibility wrapper instead specifying to skip, and no policy 
> would be needed (if you want the new behavior, just use parse_arguments).

The C++-implemented command would be able to handle both the existing
positional or a new proposed keyword-based signature.  The name
"parse_arguments" is not specific enough about what kind of arguments
it parses.  By keeping the name as "cmake_parse_arguments" it indicates
that it parses cmake-language arguments, though another name such as
"process_cmake_command_arguments" would do that too.

An advantage of keeping the name is that existing callers get the
speed-up immediately.  Furthermore there will be less code left in the
old module to maintain.

Matthew, would you have time to work on the C++ impl?  I think we could
start with reproducing the current signature.  Optionally add the policy
for handling empty arguments.  Then add a proposed keyword-based sig
that handles empty arguments always.

Thanks,
-Brad



More information about the cmake-developers mailing list