diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 63bf03bdda..014ef67932 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1759,6 +1759,10 @@ void cmMakefile::AddDefinition(const char* name, bool value) void cmMakefile::CheckForUnusedVariables() const { + if (!this->WarnUnused) + { + return; + } const cmDefinitions& defs = this->Internal->VarStack.top(); const std::set& locals = defs.LocalKeys(); std::set::const_iterator it = locals.begin();