Commit Graph

8 Commits

Author SHA1 Message Date
Matthew Woehlke 66c70cd9f1 cmake_parse_arguments: Add additional unit tests
Add additional unit tests for some corner cases in argument splitting.
2016-09-28 15:20:42 -04:00
Matthew Woehlke 41291b20f3 cmake_parse_arguments: Fix PARSE_ARGV multi-value argument handling
The `PARSE_ARGV` mode was recently added to help functions properly
parse their arguments even when those arguments may be quoted and
contain literal `;` in their values.  Fix the implementation to encode
`;`s in reported multi-value arguments and in `UNPARSED_ARGUMENTS` so
that `;`s in the individual values are preserved in the lists.  This
allows clients to access all their argument values correctly.
2016-09-28 14:18:20 -04:00
Bill Hoffman cb299acc27 cmake_parse_arguments: Add option to read arguments from ARGC/ARGV#
The `ARGC`/`ARGV#` variables in function scope hold the original
arguments with no ;-list flattening.  Add a way for functions to
cleanly parse arguments that may contain `;`.  This also avoids
extra copying of the arguments.

Co-Author: Brad King <brad.king@kitware.com>
2016-09-08 11:33:46 -04:00
Dimitar Yordanov 430251245e cmake_parse_arguments: Additional regression tests
Add regression tests for the arguments handling in
cmake_parse_arguments. The tests were run also against cmake 3.4.1
maint branch to verify that there are no regressions.

Signed-off-by: Dimitar Yordanov <dimitar.yordanov@sap.com>
Signed-off-by: Matthias Maennich <matthias.maennich@sap.com>
2016-02-24 10:07:30 -05:00
Dimitar Yordanov c8c45a2c4e cmake_parse_arguments: Restore ;-list argument flattening
The re-implementation in commit v3.5.0-rc1~116^2~1 (CMakeParseArguments:
replace by native cmake_parse_arguments command, 2015-12-05) introduced
a regression when parsing the ARGN arguments with cmake_parse_arguments.
The original implementation used

    foreach(currentArg ${ARGN})

to iterate over input arguments.  This flattened ;-lists within the
arguments whether they were quoted or not.  Fix our new implementation
to preserve this behavior and add a test case to cover it.

Signed-off-by: Dimitar Yordanov <dimitar.yordanov@sap.com>
Signed-off-by: Matthias Maennich <matthias.maennich@sap.com>
2016-02-12 11:19:40 -05:00
Matthias Maennich ab8a280857 cmake_parse_arguments: consider duplicate keyword as warning
The behaviour of double specified keywords is rather undefined or at
least not clearly documented. This change introduces a strict check and
emits a warning in case a keyword has been specified more than once.
2015-12-17 10:45:19 -05:00
Matthias Maennich e8b148318f CMakeParseArguments: replace by native cmake_parse_arguments command
Implement a native `cmake_parse_arguments` command that is fully
compatible with the documented behaviour of the previous implementation.
Leave the CMakeParseArguments module empty but existing for
compatibility.
2015-12-17 10:44:28 -05:00
Matthias Maennich cbbdfc2b61 CMakeParseArguments: add a RunCMake test suite 2015-12-17 10:31:04 -05:00