diff options
-rw-r--r-- | Source/cmake.cxx | 14 | ||||
-rw-r--r-- | Source/cmake.h | 6 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 4 |
3 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2e77748..41f2775 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -141,6 +141,8 @@ cmake::cmake() { this->Trace = false; this->StrictMode = false; + this->FindUnused = false; + this->DefaultToUsed = false; this->SuppressDevWarnings = false; this->DoSuppressDevWarnings = false; this->DebugOutput = false; @@ -619,6 +621,18 @@ void cmake::SetArgs(const std::vector<std::string>& args) std::cout << "Running in strict mode.\n"; this->SetStrictMode(true); } + else if(arg.find("--find-unused",0) == 0) + { + std::cout << "Finding unused command line variables.\n"; + this->SetFindUnused(true); + this->SetDefaultToUsed(true); + } + else if(arg.find("--find-unused-all",0) == 0) + { + std::cout << "Finding unused variables.\n"; + this->SetFindUnused(true); + this->SetDefaultToUsed(false); + } else if(arg.find("-G",0) == 0) { std::string value = arg.substr(2); diff --git a/Source/cmake.h b/Source/cmake.h index 5c2f17a..7b612ea 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -308,6 +308,10 @@ class cmake void SetTrace(bool b) { this->Trace = b;} bool GetStrictMode() { return this->StrictMode;} void SetStrictMode(bool b) { this->StrictMode = b;} + bool GetFindUnused() { return this->FindUnused;} + void SetFindUnused(bool b) { this->FindUnused = b;} + bool GetDefaultToUsed() { return this->DefaultToUsed;} + void SetDefaultToUsed(bool b) { this->DefaultToUsed = b;} // Define a property void DefineProperty(const char *name, cmProperty::ScopeType scope, const char *ShortDescription, @@ -446,6 +450,8 @@ private: bool DebugOutput; bool Trace; bool StrictMode; + bool FindUnused; + bool DefaultToUsed; std::string CMakeEditCommand; std::string CMakeCommand; std::string CXXEnvironment; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index ac2a338..235aaf5 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -123,6 +123,10 @@ static const char * cmDocumentationOptions[][3] = {"--strict-mode", "Put cmake in strict mode.", "In strict mode cmake will print a warning when an uninitialized variable " "is used."}, + {"--find-unused", "Find unused variables.", + "Find variables that are declared on the command line, but not used."}, + {"--find-unused-all", "Find all unused variables.", + "Find variables that are declared, but not used."}, {"--help-command cmd [file]", "Print help for a single command and exit.", "Full documentation specific to the given command is displayed. " "If a file is specified, the documentation is written into and the output " |