ENH: allow unset vars to be used in list length
This commit is contained in:
parent
ca5647c92c
commit
a0471c3fe2
|
@ -106,11 +106,10 @@ bool cmListCommand::HandleLengthCommand(std::vector<std::string> const& args)
|
|||
const std::string& listName = args[1];
|
||||
const std::string& variableName = args[args.size() - 1];
|
||||
std::vector<std::string> varArgsExpanded;
|
||||
if ( !this->GetList(varArgsExpanded, listName.c_str()) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// do not check the return value here
|
||||
// if the list var is not found varArgsExpanded will have size 0
|
||||
// and we will return 0
|
||||
this->GetList(varArgsExpanded, listName.c_str());
|
||||
size_t length = varArgsExpanded.size();
|
||||
char buffer[1024];
|
||||
sprintf(buffer, "%d", static_cast<int>(length));
|
||||
|
|
Loading…
Reference in New Issue