summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-06-14 13:00:11 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-06-14 13:00:11 (GMT)
commitf247474eb68cc0c96eb20164d0e52e14e3efb7d7 (patch)
treedd53df593f69364945fbe34eef3a359ac42d677c /Source
parentbc3a7b61e261c9299b81d572d3fa3c78f87ec075 (diff)
parentdc03499595086ec190d55c59c8589c112362dbb6 (diff)
downloadCMake-f247474eb68cc0c96eb20164d0e52e14e3efb7d7.zip
CMake-f247474eb68cc0c96eb20164d0e52e14e3efb7d7.tar.gz
CMake-f247474eb68cc0c96eb20164d0e52e14e3efb7d7.tar.bz2
Merge topic 'remove_extra_matches'
dc03499 Do not set CMAKE_MATCH_ variables when not neeeded
Diffstat (limited to 'Source')
-rw-r--r--Source/cmStringCommand.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 1fbde01..68ba13f 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -534,8 +534,12 @@ void cmStringCommand::ClearMatches(cmMakefile* mf)
{
char name[128];
sprintf(name, "CMAKE_MATCH_%d", i);
- mf->AddDefinition(name, "");
- mf->MarkVariableAsUsed(name);
+ const char* s = mf->GetDefinition(name);
+ if(s && *s != 0)
+ {
+ mf->AddDefinition(name, "");
+ mf->MarkVariableAsUsed(name);
+ }
}
}
@@ -544,10 +548,14 @@ 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);
- mf->AddDefinition(name, re.match(i).c_str());
- mf->MarkVariableAsUsed(name);
+ std::string m = re.match(i);
+ if(m.size() > 0)
+ {
+ char name[128];
+ sprintf(name, "CMAKE_MATCH_%d", i);
+ mf->AddDefinition(name, re.match(i).c_str());
+ mf->MarkVariableAsUsed(name);
+ }
}
}