GRAPHVIZ_IGNORE_TARGETS is now a list of regular expressions

This is similar e.g. to CTEST_CUSTOM_WARNING_EXCEPTION from ctest.
GRAPHVIZ_TARGET_IGNORE_REGEX is not supported anymore.
I hope this is ok, since this was 100% undocumented and can't
break a build.

Alex
This commit is contained in:
Alex Neundorf 2011-02-05 19:09:54 +01:00
parent 5698ad2047
commit 4f96a7621f
2 changed files with 31 additions and 25 deletions

View File

@ -119,28 +119,28 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
__set_bool_if_set(this->GenerateForModuleLibs, "GRAPHVIZ_MODULE_LIBS"); __set_bool_if_set(this->GenerateForModuleLibs, "GRAPHVIZ_MODULE_LIBS");
__set_bool_if_set(this->GenerateForExternals, "GRAPHVIZ_EXTERNAL_LIBS"); __set_bool_if_set(this->GenerateForExternals, "GRAPHVIZ_EXTERNAL_LIBS");
cmStdString tmpRegexString; cmStdString ignoreTargetsRegexes;
__set_if_set(tmpRegexString, "GRAPHVIZ_TARGET_IGNORE_REGEX"); __set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS");
if (tmpRegexString.size() > 0)
{
if (!this->TargetIgnoreRegex.compile(tmpRegexString.c_str()))
{
std::cerr << "Could not compile bad regex \"" << tmpRegexString << "\""
<< std::endl;
}
}
this->TargetsToIgnore.clear(); this->TargetsToIgnoreRegex.clear();
const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS"); if (ignoreTargetsRegexes.size() > 0)
if ( ignoreTargets )
{ {
std::vector<std::string> ignoreTargetsVector; std::vector<std::string> ignoreTargetsRegExVector;
cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector); cmSystemTools::ExpandListArgument(ignoreTargetsRegexes,
for(std::vector<std::string>::iterator itvIt = ignoreTargetsVector.begin(); ignoreTargetsRegExVector);
itvIt != ignoreTargetsVector.end(); for(std::vector<std::string>::const_iterator itvIt
= ignoreTargetsRegExVector.begin();
itvIt != ignoreTargetsRegExVector.end();
++ itvIt ) ++ itvIt )
{ {
this->TargetsToIgnore.insert(itvIt->c_str()); cmStdString currentRegexString(*itvIt);
cmsys::RegularExpression currentRegex;
if (!currentRegex.compile(currentRegexString.c_str()))
{
std::cerr << "Could not compile bad regex \"" << currentRegexString
<< "\"" << std::endl;
}
this->TargetsToIgnoreRegex.push_back(currentRegex);
} }
} }
@ -415,14 +415,22 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
bool cmGraphVizWriter::IgnoreThisTarget(const char* name) bool cmGraphVizWriter::IgnoreThisTarget(const char* name)
{ {
if (this->TargetIgnoreRegex.is_valid()) for(std::vector<cmsys::RegularExpression>::iterator itvIt
= this->TargetsToIgnoreRegex.begin();
itvIt != this->TargetsToIgnoreRegex.end();
++ itvIt )
{ {
if (this->TargetIgnoreRegex.find(name)) cmsys::RegularExpression& regEx = *itvIt;
if (regEx.is_valid())
{ {
return true; if (regEx.find(name))
{
return true;
}
} }
} }
return (this->TargetsToIgnore.find(name) != this->TargetsToIgnore.end());
return false;
} }

View File

@ -69,9 +69,7 @@ protected:
bool GenerateForModuleLibs; bool GenerateForModuleLibs;
bool GenerateForExternals; bool GenerateForExternals;
cmsys::RegularExpression TargetIgnoreRegex; std::vector<cmsys::RegularExpression> TargetsToIgnoreRegex;
std::set<cmStdString> TargetsToIgnore;
const std::vector<cmLocalGenerator*>& LocalGenerators; const std::vector<cmLocalGenerator*>& LocalGenerators;