From d784e6af4d292e5ffee4b43b7ee740d1fa8e2e29 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 2 Sep 2010 11:29:05 -0400 Subject: [PATCH] Run the unused variables check on the final pass --- Source/cmMakefile.cxx | 2 ++ Source/cmake.cxx | 34 +++++++++++++++++++--------------- Source/cmake.h | 2 ++ 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3a235905b..288bc531a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -828,6 +828,8 @@ void cmMakefile::ConfigureFinalPass() { l->second.FinishConfigure(); } + + this->GetCMakeInstance()->RunCheckForUnusedVariables(); } //---------------------------------------------------------------------------- diff --git a/Source/cmake.cxx b/Source/cmake.cxx index cb70f1f91..b3261c59b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -201,21 +201,6 @@ cmake::cmake() cmake::~cmake() { -#ifdef CMAKE_BUILD_WITH_CMAKE - if(this->WarnUnusedCli) - { - std::map::const_iterator it; - for(it = this->UsedCliVariables.begin(); it != this->UsedCliVariables.end(); ++it) - { - if(!it->second) - { - std::string message = "warning: The variable, \"" + it->first + "\", given " - "on the command line, was not used within the build."; - cmSystemTools::Message(message.c_str()); - } - } - } -#endif delete this->CacheManager; delete this->Policies; if (this->GlobalGenerator) @@ -4500,3 +4485,22 @@ int cmake::Build(const std::string& dir, config.c_str(), clean, false, 0, true, 0, nativeOptions); } + +void cmake::RunCheckForUnusedVariables() const +{ +#ifdef CMAKE_BUILD_WITH_CMAKE + if(this->WarnUnusedCli) + { + std::map::const_iterator it; + for(it = this->UsedCliVariables.begin(); it != this->UsedCliVariables.end(); ++it) + { + if(!it->second) + { + std::string message = "warning: The variable, \"" + it->first + "\", given " + "on the command line, was not used within the build."; + cmSystemTools::Message(message.c_str()); + } + } + } +#endif +} diff --git a/Source/cmake.h b/Source/cmake.h index 403809fcd..4277bdd01 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -362,6 +362,8 @@ class cmake const std::string& config, const std::vector& nativeOptions, bool clean); + + void RunCheckForUnusedVariables() const; protected: void InitializeProperties(); int HandleDeleteCacheVariables(const char* var);