Merge topic 'list-command-argument-fixes'
08c71ac
CMake.List test: explicitely test with lists containing only an empty string52d9c38
list command: error on too many arguments
This commit is contained in:
commit
9f555e805d
|
@ -429,6 +429,12 @@ bool cmListCommand
|
||||||
this->SetError("sub-command REVERSE requires a list as an argument.");
|
this->SetError("sub-command REVERSE requires a list as an argument.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if(args.size() > 2)
|
||||||
|
{
|
||||||
|
this->SetError(
|
||||||
|
"sub-command REVERSE only takes one argument.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& listName = args[1];
|
const std::string& listName = args[1];
|
||||||
// expand the variable
|
// expand the variable
|
||||||
|
@ -463,6 +469,12 @@ bool cmListCommand
|
||||||
"sub-command REMOVE_DUPLICATES requires a list as an argument.");
|
"sub-command REMOVE_DUPLICATES requires a list as an argument.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if(args.size() > 2)
|
||||||
|
{
|
||||||
|
this->SetError(
|
||||||
|
"sub-command REMOVE_DUPLICATES only takes one argument.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& listName = args[1];
|
const std::string& listName = args[1];
|
||||||
// expand the variable
|
// expand the variable
|
||||||
|
@ -506,6 +518,12 @@ bool cmListCommand
|
||||||
this->SetError("sub-command SORT requires a list as an argument.");
|
this->SetError("sub-command SORT requires a list as an argument.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if(args.size() > 2)
|
||||||
|
{
|
||||||
|
this->SetError(
|
||||||
|
"sub-command SORT only takes one argument.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& listName = args[1];
|
const std::string& listName = args[1];
|
||||||
// expand the variable
|
// expand the variable
|
||||||
|
|
|
@ -86,3 +86,14 @@ TEST("REVERSE result" "ken;brad;bill;andy")
|
||||||
set(result bill andy bill brad ken ken ken)
|
set(result bill andy bill brad ken ken ken)
|
||||||
list(REMOVE_DUPLICATES result)
|
list(REMOVE_DUPLICATES result)
|
||||||
TEST("REMOVE_DUPLICATES result" "bill;andy;brad;ken")
|
TEST("REMOVE_DUPLICATES result" "bill;andy;brad;ken")
|
||||||
|
|
||||||
|
# these commands should just do nothing if the list is already empty
|
||||||
|
set(result "")
|
||||||
|
list(REMOVE_DUPLICATES result)
|
||||||
|
TEST("REMOVE_DUPLICATES empty result" "")
|
||||||
|
|
||||||
|
list(REVERSE result)
|
||||||
|
TEST("REVERSE empty result" "")
|
||||||
|
|
||||||
|
list(SORT result)
|
||||||
|
TEST("SORT empty result" "")
|
||||||
|
|
Loading…
Reference in New Issue