summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-04-01 19:50:00 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-04-01 19:50:00 (GMT)
commit2b4e802a947ad5fd86b1ed296ea2f31714270dfa (patch)
treebe60c3647d20108a37bd2bfdf765ef8c7ef3d180
parent92897bf3a8df0def74a3af36015dc3d7ba69aa25 (diff)
downloadCMake-2b4e802a947ad5fd86b1ed296ea2f31714270dfa.zip
CMake-2b4e802a947ad5fd86b1ed296ea2f31714270dfa.tar.gz
CMake-2b4e802a947ad5fd86b1ed296ea2f31714270dfa.tar.bz2
ENH: fix for regkey and ; separation
-rw-r--r--Source/cmSystemTools.cxx59
1 files changed, 45 insertions, 14 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index da6ea4c..6a2a56b 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1785,32 +1785,63 @@ void cmSystemTools::ExpandListArguments(std::vector<std::string> const& argument
std::vector<std::string>::const_iterator i;
for(i = arguments.begin();i != arguments.end(); ++i)
{
- if(i->find(';') != std::string::npos)
+ // if there are no ; in the name then just copy the current string
+ if(i->find(';') == std::string::npos)
+ {
+ newargs.push_back(*i);
+ }
+ else
{
std::string::size_type start = 0;
std::string::size_type endpos = 0;
- while(endpos != std::string::npos)
+ const std::string::size_type size = i->size();
+ // break up ; separated sections of the string into separate strings
+ while(endpos != size)
{
endpos = i->find(';', start);
- std::string::size_type len;
- if(endpos != std::string::npos)
+ if(endpos == std::string::npos)
{
- len = endpos - start;
- }
- else
- {
- len = i->size()-start;
+ endpos = i->size();
}
+ std::string::size_type len = endpos - start;
if (len > 0)
{
- newargs.push_back(i->substr(start, len));
+ // check for a closing ] after the start position
+ if(i->find('[', start) == std::string::npos)
+ {
+ // if there is no [ in the string then keep it
+ newargs.push_back(i->substr(start, len));
+ }
+ else
+ {
+ int opencount = 0;
+ int closecount = 0;
+ for(std::string::size_type j = start; j < endpos; ++j)
+ {
+ if(i->at(j) == '[')
+ {
+ ++opencount;
+ }
+ else if (i->at(j) == ']')
+ {
+ ++closecount;
+ }
+ }
+ if(opencount != closecount)
+ {
+ // skip this one
+ endpos = i->find(';', endpos+1);
+ if(endpos == std::string::npos)
+ {
+ endpos = i->size();
+ }
+ len = endpos - start;
+ }
+ newargs.push_back(i->substr(start, len));
+ }
}
start = endpos+1;
}
}
- else
- {
- newargs.push_back(*i);
- }
}
}