ENH: add a --trace option
This commit is contained in:
parent
9926b7f717
commit
6f31b0dfbd
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 "
|
||||
|
|
Loading…
Reference in New Issue