[cmake-developers] CMakeParseArguments: Do not skip empty arguments
Daniele E. Domenichelli
daniele.domenichelli at gmail.com
Wed Nov 6 05:38:32 EST 2013
On 05/11/13 20:51, Alexander Neundorf wrote:
>> I don't know if this is to be considered a change of behaviour though,
>> but I'd rather consider it a bug, and I would like to see it fixed in
>> the next bugfix release... what do you think?
>
> cmake_parse_arguments() is used in quite a few places in the meantime, so I
> don't really feel good about changing its behaviour in general.
> Maybe an option for the macro what it should do with empty values ?
Is there any of the other place where cmake_parse_arguments() has to
deal with with empty arguments? I believe that someone would have
complained about that. From what I've seen, modules that are supposed to
deal with empty arguments (like ExternalProject that can have arguments
like INSTALL_COMMAND "") do not use CMakeParseArguments...
I don't think that anyone would use something like
SINGLE "" VALUE
to assign VALUE to the SINGLE option...
Also something like
SINGLE "${EMPTY_VARIABLE}" NEXT_ARG
would assign to FOO_SINGLE the value NEXT_ARG
and that is very likely to be an unintended behaviour.
Perhaps someone could use something like
MULTI "${V1}" "${EMPTY_VARIABLE}" "${V2}"
and expect to get a list containing only V1 and V2. Nonetheless if he is
using foreach(arg ${list}), the behaviour won't change because empty
list elements are skipped. if instead he is using "foreach(arg IN LIST
list)", he is probably expecting to receive empty arguments, since the
documentation clearly states so.
Adding an option in the macro arguments would be a bit of a
non-compatible change, since the name of the option could no longer be
used as one of the "OPTION/SINGLE/MULTI" value names.
Also using a global property is not an option, because that would change
the behaviour globally, and if some module is expecting the current
behaviour it will still fail.
Cheers,
Daniele
More information about the cmake-developers
mailing list