summaryrefslogtreecommitdiffstats
path: root/Source/cmStringCommand.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-08-29 15:58:38 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-08-29 15:58:38 (GMT)
commite80acd971cdbd159140e1da76944258f437b96f4 (patch)
tree3f5918085b0411e2f036502040c1f5948e8881e8 /Source/cmStringCommand.cxx
parentfb43c6447606913ed0afca03c5018e6339e191ea (diff)
downloadCMake-e80acd971cdbd159140e1da76944258f437b96f4.zip
CMake-e80acd971cdbd159140e1da76944258f437b96f4.tar.gz
CMake-e80acd971cdbd159140e1da76944258f437b96f4.tar.bz2
ENH: also store the group matches from IF( MATCHES) in CMAKE_MATCH_(0..9)
Alex
Diffstat (limited to 'Source/cmStringCommand.cxx')
-rw-r--r--Source/cmStringCommand.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 437b121..f746f82 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -248,7 +248,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
input += args[i];
}
- this->ClearMatches();
+ this->ClearMatches(this->Makefile);
// Compile the regular expression.
cmsys::RegularExpression re;
if(!re.compile(regex.c_str()))
@@ -263,7 +263,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
std::string output;
if(re.find(input.c_str()))
{
- this->StoreMatches(re);
+ this->StoreMatches(this->Makefile, re);
std::string::size_type l = re.start();
std::string::size_type r = re.end();
if(r-l == 0)
@@ -297,7 +297,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
input += args[i];
}
- this->ClearMatches();
+ this->ClearMatches(this->Makefile);
// Compile the regular expression.
cmsys::RegularExpression re;
if(!re.compile(regex.c_str()))
@@ -314,7 +314,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
const char* p = input.c_str();
while(re.find(p))
{
- this->StoreMatches(re);
+ this->StoreMatches(this->Makefile, re);
std::string::size_type l = re.start();
std::string::size_type r = re.end();
if(r-l == 0)
@@ -401,7 +401,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
input += args[i];
}
- this->ClearMatches();
+ this->ClearMatches(this->Makefile);
// Compile the regular expression.
cmsys::RegularExpression re;
if(!re.compile(regex.c_str()))
@@ -418,7 +418,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
std::string::size_type base = 0;
while(re.find(input.c_str()+base))
{
- this->StoreMatches(re);
+ this->StoreMatches(this->Makefile, re);
std::string::size_type l2 = re.start();
std::string::size_type r = re.end();
@@ -479,24 +479,24 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
}
//----------------------------------------------------------------------------
-void cmStringCommand::ClearMatches()
+void cmStringCommand::ClearMatches(cmMakefile* mf)
{
for (unsigned int i=0; i<10; i++)
{
char name[128];
sprintf(name, "CMAKE_MATCH_%d", i);
- this->Makefile->AddDefinition(name, "");
+ mf->AddDefinition(name, "");
}
}
//----------------------------------------------------------------------------
-void cmStringCommand::StoreMatches(cmsys::RegularExpression& re)
+void cmStringCommand::StoreMatches(cmMakefile* mf,cmsys::RegularExpression& re)
{
for (unsigned int i=0; i<10; i++)
{
char name[128];
sprintf(name, "CMAKE_MATCH_%d", i);
- this->Makefile->AddDefinition(name, re.match(i).c_str());
+ mf->AddDefinition(name, re.match(i).c_str());
}
}