summaryrefslogtreecommitdiffstats
path: root/Source/cmCommandArgumentParserHelper.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2010-09-01 15:24:20 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2010-09-01 17:09:08 (GMT)
commit74997000c89ee3a82d68e4107d4a4264e7e57229 (patch)
tree2551f29fd89495df47cec7bbded5efaa6e074239 /Source/cmCommandArgumentParserHelper.cxx
parentfff9f6d6f74aa92d0bc4adf3a80a25b1b662458d (diff)
downloadCMake-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.cxx14
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)