ENH: Adding option to return empty arguments when expanding a list.

This commit is contained in:
Brad King 2006-02-09 19:03:27 -05:00
parent 1b5e3f4136
commit db0681d2f6
2 changed files with 7 additions and 5 deletions

View File

@ -973,10 +973,11 @@ void cmSystemTools::ExpandList(std::vector<std::string> const& arguments,
} }
void cmSystemTools::ExpandListArgument(const std::string& arg, void cmSystemTools::ExpandListArgument(const std::string& arg,
std::vector<std::string>& newargs) std::vector<std::string>& newargs,
bool emptyArgs)
{ {
// If argument is empty, it is an empty list. // If argument is empty, it is an empty list.
if(arg.length() == 0) if(arg.length() == 0 && !emptyArgs)
{ {
return; return;
} }
@ -1027,7 +1028,7 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
// brackets. // brackets.
if(squareNesting == 0) if(squareNesting == 0)
{ {
if ( newArgVec.size() ) if ( newArgVec.size() || emptyArgs )
{ {
// Add the last argument if the string is not empty. // Add the last argument if the string is not empty.
newArgVec.push_back(0); newArgVec.push_back(0);
@ -1047,7 +1048,7 @@ void cmSystemTools::ExpandListArgument(const std::string& arg,
} break; } break;
} }
} }
if ( newArgVec.size() ) if ( newArgVec.size() || emptyArgs )
{ {
// Add the last argument if the string is not empty. // Add the last argument if the string is not empty.
newArgVec.push_back(0); newArgVec.push_back(0);

View File

@ -39,7 +39,8 @@ public:
static void ExpandList(std::vector<std::string> const& argsIn, static void ExpandList(std::vector<std::string> const& argsIn,
std::vector<std::string>& argsOut); std::vector<std::string>& argsOut);
static void ExpandListArgument(const std::string& arg, static void ExpandListArgument(const std::string& arg,
std::vector<std::string>& argsOut); std::vector<std::string>& argsOut,
bool emptyArgs=false);
/** /**
* Look for and replace registry values in a string * Look for and replace registry values in a string