Commit c8c45a2c authored by Dimitar's avatar Dimitar Committed by Brad King

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's avatarDimitar Yordanov <dimitar.yordanov@sap.com>
Signed-off-by: default avatarMatthias Maennich <matthias.maennich@sap.com>
parent a5a5a685
......@@ -97,10 +97,18 @@ bool cmParseArgumentsCommand
} insideValues = NONE;
std::string currentArgName;
// now iterate over the remaining arguments
// and fill in the values where applicable
// Flatten ;-lists in the arguments into a single list as was done
// by the original function(CMAKE_PARSE_ARGUMENTS).
list.clear();
for(; argIter != argEnd; ++argIter)
{
cmSystemTools::ExpandListArgument(*argIter, list);
}
// iterate over the arguments list and fill in the values where applicable
for (argIter = list.begin(), argEnd = list.end();
argIter != argEnd; ++argIter)
{
const options_map::iterator optIter = options.find(*argIter);
if (optIter != options.end())
{
......
......@@ -13,3 +13,22 @@ cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}"
TEST(MY_INSTALL_DESTINATION UNDEFINED)
TEST(MY_INSTALL_OPTIONAL TRUE)
macro(foo)
set(_options )
set(_oneValueArgs FOO)
set(_multiValueArgs )
cmake_parse_arguments(_FOO2 "${_options}"
"${_oneValueArgs}"
"${_multiValueArgs}"
"${ARGN}")
cmake_parse_arguments(_FOO1 "${_options}"
"${_oneValueArgs}"
"${_multiValueArgs}"
${ARGN})
endmacro()
foo(FOO foo)
TEST(_FOO1_FOO foo)
TEST(_FOO2_FOO foo)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment