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* srcRoot = this->Makefile->GetDefinition("CMAKE_SOURCE_DIR");
const char* binRoot = this->Makefile->GetDefinition("CMAKE_BINARY_DIR"); const char* binRoot = this->Makefile->GetDefinition("CMAKE_BINARY_DIR");
if (this->CheckSystemVars || strstr(this->FileName, srcRoot) == this->FileName || if (this->CheckSystemVars ||
strstr(this->FileName, binRoot) == this->FileName) cmSystemTools::IsSubDirectory(this->FileName, this->Makefile->GetHomeDirectory()) ||
cmSystemTools::IsSubDirectory(this->FileName, this->Makefile->GetHomeOutputDirectory()))
{ {
cmOStringStream msg; cmOStringStream msg;
msg << this->FileName << ":" << this->FileLine << ":" << msg << this->FileName << ":" << this->FileLine << ":" <<

View File

@ -3394,9 +3394,9 @@ void cmMakefile::PopScope()
if (this->WarnUnused && usage.find(*it) == usage.end()) if (this->WarnUnused && usage.find(*it) == usage.end())
{ {
const char* cdir = this->ListFileStack.back().c_str(); const char* cdir = this->ListFileStack.back().c_str();
const char* srcRoot = this->GetDefinition("CMAKE_SOURCE_DIR"); if (this->CheckSystemVars ||
const char* binRoot = this->GetDefinition("CMAKE_BINARY_DIR"); cmSystemTools::IsSubDirectory(cdir, this->GetHomeDirectory()) ||
if (this->CheckSystemVars || strstr(cdir, srcRoot) == cdir || strstr(cdir, binRoot) == cdir) cmSystemTools::IsSubDirectory(cdir, this->GetHomeOutputDirectory()))
{ {
cmOStringStream m; cmOStringStream m;
m << "unused variable \'" << *it << "\'"; m << "unused variable \'" << *it << "\'";