Do not set CMAKE_MATCH_ variables when not neeeded
Each call to AddDefinition has overhead for variable watches and such. Avoid extra calls when not needed. This decreases the configure time for ParaView by 10 seconds on my machine. Without the change about 1,000,000 set-to-empty calls were being made. After the change it drops to about 100,000.
This commit is contained in:
parent
6927b25aff
commit
dc03499595
|
@ -534,21 +534,29 @@ void cmStringCommand::ClearMatches(cmMakefile* mf)
|
|||
{
|
||||
char name[128];
|
||||
sprintf(name, "CMAKE_MATCH_%d", i);
|
||||
const char* s = mf->GetDefinition(name);
|
||||
if(s && *s != 0)
|
||||
{
|
||||
mf->AddDefinition(name, "");
|
||||
mf->MarkVariableAsUsed(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmStringCommand::StoreMatches(cmMakefile* mf,cmsys::RegularExpression& re)
|
||||
{
|
||||
for (unsigned int i=0; i<10; i++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue