diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-07-31 14:33:25 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-07-31 14:33:25 (GMT) |
commit | 6f31b0dfbd5fbd234d08f716703b6d05c659e086 (patch) | |
tree | 410fc30c88ba41252b2949d2cc6ff6f8d087e8d3 | |
parent | 9926b7f717f90ca6b5055d1cbf205f258466df99 (diff) | |
download | CMake-6f31b0dfbd5fbd234d08f716703b6d05c659e086.zip CMake-6f31b0dfbd5fbd234d08f716703b6d05c659e086.tar.gz CMake-6f31b0dfbd5fbd234d08f716703b6d05c659e086.tar.bz2 |
ENH: add a --trace option
-rw-r--r-- | Source/cmMakefile.cxx | 15 | ||||
-rw-r--r-- | Source/cmake.cxx | 6 | ||||
-rw-r--r-- | Source/cmake.h | 4 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 3 |
4 files changed, 28 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fca2f7e..7e035e1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -395,6 +395,21 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, if(pcmd->GetEnabled() && !cmSystemTools::GetFatalErrorOccured() && (!this->GetCMakeInstance()->GetScriptMode() || pcmd->IsScriptable())) { + // if trace is one, print out invoke information + if(this->GetCMakeInstance()->GetTrace()) + { + cmOStringStream msg; + msg << lff.FilePath << "(" << lff.Line << "): "; + msg << lff.Name << "("; + for(std::vector<cmListFileArgument>::const_iterator i = + lff.Arguments.begin(); i != lff.Arguments.end(); ++i) + { + msg << i->Value; + msg << " "; + } + msg << ")"; + cmSystemTools::Message(msg.str().c_str()); + } // Try invoking the command. if(!pcmd->InvokeInitialPass(lff.Arguments,status) || status.GetNestedError()) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index df95155..3a0a463 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -140,6 +140,7 @@ void cmNeedBackwardsCompatibility(const std::string& variable, cmake::cmake() { + this->Trace = false; this->SuppressDevWarnings = false; this->DoSuppressDevWarnings = false; this->DebugOutput = false; @@ -618,6 +619,11 @@ void cmake::SetArgs(const std::vector<std::string>& args) std::cout << "Running with debug output on.\n"; this->SetDebugOutputOn(true); } + else if(arg.find("--trace",0) == 0) + { + std::cout << "Running with trace output on.\n"; + this->SetTrace(true); + } else if(arg.find("-G",0) == 0) { std::string value = arg.substr(2); diff --git a/Source/cmake.h b/Source/cmake.h index 1c4351a..8d030c7 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -314,6 +314,9 @@ class cmake bool GetDebugOutput() { return this->DebugOutput; } void SetDebugOutputOn(bool b) { this->DebugOutput = b;} + // Do we want trace output during the cmake run. + bool GetTrace() { return this->Trace;} + void SetTrace(bool b) { this->Trace = b;} // Define a property void DefineProperty(const char *name, cmProperty::ScopeType scope, const char *ShortDescription, @@ -438,6 +441,7 @@ private: bool InTryCompile; bool ScriptMode; bool DebugOutput; + bool Trace; std::string CMakeEditCommand; std::string CMakeCommand; std::string CXXEnvironment; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 83718dd..601c060 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -101,6 +101,9 @@ static const char * cmDocumentationOptions[][3] = {"--debug-output", "Put cmake in a debug mode.", "Print extra stuff during the cmake run like stack traces with " "message(send_error ) calls."}, + {"--trace", "Put cmake in trace mode.", + "Print a trace of all calls made and from where with " + "message(send_error ) calls."}, {"--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 " |