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/cmCommandArgumentParserHelper.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/cmCommandArgumentParserHelper.cxx')
-rw-r--r-- | Source/cmCommandArgumentParserHelper.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 1460e5d..e9381d4 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -21,6 +21,7 @@ int cmCommandArgument_yyparse( yyscan_t yyscanner ); cmCommandArgumentParserHelper::cmCommandArgumentParserHelper() { this->WarnUninitialized = false; + this->CheckSystemVars = false; this->FileLine = -1; this->FileName = 0; this->RemoveEmpty = true; @@ -129,10 +130,14 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) // not been "cleared"/initialized with a set(foo ) call if(this->WarnUninitialized && !this->Makefile->VariableInitialized(var)) { - cmOStringStream msg; - msg << this->FileName << ":" << this->FileLine << ":" << - " warning: uninitialized variable \'" << var << "\'"; - cmSystemTools::Message(msg.str().c_str()); + const char* root = this->Makefile->GetDefinition("CMAKE_ROOT"); + if (this->CheckSystemVars || strstr(this->FileName, root) != this->FileName) + { + cmOStringStream msg; + msg << this->FileName << ":" << this->FileLine << ":" << + " warning: uninitialized variable \'" << var << "\'"; + cmSystemTools::Message(msg.str().c_str()); + } } return 0; } @@ -331,6 +336,7 @@ void cmCommandArgumentParserHelper::SetMakefile(const cmMakefile* mf) { this->Makefile = mf; this->WarnUninitialized = mf->GetCMakeInstance()->GetWarnUninitialized(); + this->CheckSystemVars = mf->GetCMakeInstance()->GetCheckSystemVars(); } void cmCommandArgumentParserHelper::SetResult(const char* value) |