diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-01 15:24:20 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-01 17:09:08 (GMT) |
commit | 74997000c89ee3a82d68e4107d4a4264e7e57229 (patch) | |
tree | 2551f29fd89495df47cec7bbded5efaa6e074239 /Source/cmMakefile.cxx | |
parent | fff9f6d6f74aa92d0bc4adf3a80a25b1b662458d (diff) | |
download | CMake-74997000c89ee3a82d68e4107d4a4264e7e57229.zip CMake-74997000c89ee3a82d68e4107d4a4264e7e57229.tar.gz CMake-74997000c89ee3a82d68e4107d4a4264e7e57229.tar.bz2 |
Add a flag to warn about system files
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 242900e..3a23590 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -93,6 +93,7 @@ cmMakefile::cmMakefile(): Internal(new Internals) this->Initialize(); this->PreOrder = false; this->WarnUnused = false; + this->CheckSystemVars = false; } cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals) @@ -136,6 +137,7 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals) this->Properties = mf.Properties; this->PreOrder = mf.PreOrder; this->WarnUnused = mf.WarnUnused; + this->CheckSystemVars = mf.CheckSystemVars; this->ListFileStack = mf.ListFileStack; this->Initialize(); } @@ -774,6 +776,7 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg) this->Internal->VarUsageStack.push(std::set<cmStdString>()); } } + this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); } bool cmMakefile::NeedBackwardsCompatibility(unsigned int major, @@ -3386,9 +3389,14 @@ void cmMakefile::PopScope() init.erase(*it); if (this->WarnUnused && usage.find(*it) == usage.end()) { - cmOStringStream m; - m << "unused variable \'" << *it << "\'"; - this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); + const char* cdir = this->ListFileStack.back().c_str(); + const char* root = this->GetDefinition("CMAKE_ROOT"); + if (this->CheckSystemVars || strstr(cdir, root) != cdir) + { + cmOStringStream m; + m << "unused variable \'" << *it << "\'"; + this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); + } } else { |