From db0681d2f6368fa703253f19ce1b00baad2c9757 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 9 Feb 2006 19:03:27 -0500 Subject: [PATCH] ENH: Adding option to return empty arguments when expanding a list. --- Source/cmSystemTools.cxx | 9 +++++---- Source/cmSystemTools.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 52032f0ee..1bee080a2 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -973,10 +973,11 @@ void cmSystemTools::ExpandList(std::vector const& arguments, } void cmSystemTools::ExpandListArgument(const std::string& arg, - std::vector& newargs) + std::vector& newargs, + bool emptyArgs) { // If argument is empty, it is an empty list. - if(arg.length() == 0) + if(arg.length() == 0 && !emptyArgs) { return; } @@ -1027,7 +1028,7 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, // brackets. if(squareNesting == 0) { - if ( newArgVec.size() ) + if ( newArgVec.size() || emptyArgs ) { // Add the last argument if the string is not empty. newArgVec.push_back(0); @@ -1047,7 +1048,7 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, } break; } } - if ( newArgVec.size() ) + if ( newArgVec.size() || emptyArgs ) { // Add the last argument if the string is not empty. newArgVec.push_back(0); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 6c5be9908..a07a7b880 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -39,7 +39,8 @@ public: static void ExpandList(std::vector const& argsIn, std::vector& argsOut); static void ExpandListArgument(const std::string& arg, - std::vector& argsOut); + std::vector& argsOut, + bool emptyArgs=false); /** * Look for and replace registry values in a string