summaryrefslogtreecommitdiffstats
path: root/Source/cmCommandArgumentParserHelper.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2010-07-12 19:48:51 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2010-09-01 17:08:14 (GMT)
commitf794d589a44918c905911eb7688d69350922c6b3 (patch)
treec5893a8eff5b26496740c5e4b77e47ca73268c8b /Source/cmCommandArgumentParserHelper.cxx
parent48b5b855934be341c02139c0bed88c35c1b40d8f (diff)
downloadCMake-f794d589a44918c905911eb7688d69350922c6b3.zip
CMake-f794d589a44918c905911eb7688d69350922c6b3.tar.gz
CMake-f794d589a44918c905911eb7688d69350922c6b3.tar.bz2
Make --strict-mode option, and integrate with cmake-gui
Diffstat (limited to 'Source/cmCommandArgumentParserHelper.cxx')
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 027a2ba..410058f 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -20,6 +20,7 @@ int cmCommandArgument_yyparse( yyscan_t yyscanner );
//
cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
{
+ this->StrictMode = false;
this->FileLine = -1;
this->FileName = 0;
this->RemoveEmpty = true;
@@ -123,10 +124,15 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
const char* value = this->Makefile->GetDefinition(var);
if(!value && !this->RemoveEmpty)
{
- if(!this->Makefile->VariableCleared(var))
+ // check to see if we need to print a warning
+ // if strict mode is on and the variable has
+ // not been "cleared"/initialized with a set(foo ) call
+ if(this->StrictMode && !this->Makefile->VariableCleared(var))
{
- std::cerr << this->FileName << ":" << this->FileLine << ":" <<
- " warning: uninitialized variable \'" << var << "\'\n";
+ cmOStringStream msg;
+ msg << this->FileName << ":" << this->FileLine << ":" <<
+ " warning: uninitialized variable \'" << var << "\'";
+ cmSystemTools::Message(msg.str().c_str());
}
return 0;
}
@@ -324,6 +330,7 @@ void cmCommandArgumentParserHelper::Error(const char* str)
void cmCommandArgumentParserHelper::SetMakefile(const cmMakefile* mf)
{
this->Makefile = mf;
+ this->StrictMode = mf->GetCMakeInstance()->GetStrictMode();
}
void cmCommandArgumentParserHelper::SetResult(const char* value)