Use built-ins for readability and maintainability

This commit is contained in:
Ben Boeckel 2010-09-08 12:03:42 -04:00
parent 8b520158c3
commit 3801463c9f
2 changed files with 7 additions and 6 deletions

View File

@ -132,8 +132,9 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
{
const char* srcRoot = this->Makefile->GetDefinition("CMAKE_SOURCE_DIR");
const char* binRoot = this->Makefile->GetDefinition("CMAKE_BINARY_DIR");
if (this->CheckSystemVars || strstr(this->FileName, srcRoot) == this->FileName ||
strstr(this->FileName, binRoot) == this->FileName)
if (this->CheckSystemVars ||
cmSystemTools::IsSubDirectory(this->FileName, this->Makefile->GetHomeDirectory()) ||
cmSystemTools::IsSubDirectory(this->FileName, this->Makefile->GetHomeOutputDirectory()))
{
cmOStringStream msg;
msg << this->FileName << ":" << this->FileLine << ":" <<

View File

@ -778,7 +778,7 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
this->Internal->VarUsageStack.push(std::set<cmStdString>());
}
}
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
}
bool cmMakefile::NeedBackwardsCompatibility(unsigned int major,
@ -3394,9 +3394,9 @@ void cmMakefile::PopScope()
if (this->WarnUnused && usage.find(*it) == usage.end())
{
const char* cdir = this->ListFileStack.back().c_str();
const char* srcRoot = this->GetDefinition("CMAKE_SOURCE_DIR");
const char* binRoot = this->GetDefinition("CMAKE_BINARY_DIR");
if (this->CheckSystemVars || strstr(cdir, srcRoot) == cdir || strstr(cdir, binRoot) == cdir)
if (this->CheckSystemVars ||
cmSystemTools::IsSubDirectory(cdir, this->GetHomeDirectory()) ||
cmSystemTools::IsSubDirectory(cdir, this->GetHomeOutputDirectory()))
{
cmOStringStream m;
m << "unused variable \'" << *it << "\'";