ENH: do not print a call stack if the user does a message error unless --debug-output is used

This commit is contained in:
Bill Hoffman 2006-10-06 11:11:59 -04:00
parent 7f7374e818
commit 017cec95ad
4 changed files with 28 additions and 4 deletions

View File

@ -59,8 +59,14 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args)
if (send_error || fatal_error) if (send_error || fatal_error)
{ {
//cmSystemTools::Error(message.c_str()); if( !this->Makefile->GetCMakeInstance()->GetDebugOutput())
this->SetError(message.c_str()); {
cmSystemTools::Error(message.c_str());
}
else
{
this->SetError(message.c_str());
}
} }
else else
{ {
@ -77,6 +83,11 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args)
{ {
cmSystemTools::SetFatalErrorOccured(); cmSystemTools::SetFatalErrorOccured();
} }
return (!send_error && !fatal_error); // if debug is on then retru
if(this->Makefile->GetCMakeInstance()->GetDebugOutput())
{
return (!send_error && !fatal_error);
}
return true;
} }

View File

@ -111,6 +111,7 @@ void cmNeedBackwardsCompatibility(const std::string& variable,
cmake::cmake() cmake::cmake()
{ {
this->DebugOutput = false;
this->DebugTryCompile = false; this->DebugTryCompile = false;
this->ClearBuildSystem = false; this->ClearBuildSystem = false;
this->FileComparison = new cmFileTimeComparison; this->FileComparison = new cmFileTimeComparison;
@ -446,6 +447,11 @@ void cmake::SetArgs(const std::vector<std::string>& args)
std::cout << "debug trycompile on\n"; std::cout << "debug trycompile on\n";
this->DebugTryCompileOn(); this->DebugTryCompileOn();
} }
else if(arg.find("--debug-output",0) == 0)
{
std::cout << "Running with debug output on.\n";
this->DebugOutputOn();
}
else if(arg.find("-G",0) == 0) else if(arg.find("-G",0) == 0)
{ {
std::string value = arg.substr(2); std::string value = arg.substr(2);

View File

@ -281,6 +281,9 @@ class cmake
const char* GetCPackCommand(); const char* GetCPackCommand();
const char* GetCMakeCommand() { return this->CMakeCommand.c_str(); } const char* GetCMakeCommand() { return this->CMakeCommand.c_str(); }
// Do we want debug output during the cmake run.
bool GetDebugOutput() { return this->DebugOutput; }
void DebugOutputOn() { this->DebugOutput = true;}
protected: protected:
typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)(); typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)();
typedef std::map<cmStdString, typedef std::map<cmStdString,
@ -326,13 +329,14 @@ protected:
static int ExecuteLinkScript(std::vector<std::string>& args); static int ExecuteLinkScript(std::vector<std::string>& args);
cmVariableWatch* VariableWatch; cmVariableWatch* VariableWatch;
private: private:
ProgressCallbackType ProgressCallback; ProgressCallbackType ProgressCallback;
void* ProgressCallbackClientData; void* ProgressCallbackClientData;
bool Verbose; bool Verbose;
bool InTryCompile; bool InTryCompile;
bool ScriptMode; bool ScriptMode;
bool DebugOutput;
std::string CMakeCommand; std::string CMakeCommand;
std::string CXXEnvironment; std::string CXXEnvironment;
std::string CCEnvironment; std::string CCEnvironment;

View File

@ -85,6 +85,9 @@ static const cmDocumentationEntry cmDocumentationOptions[] =
{"--debug-trycompile", "Do not delete the try compile directories..", {"--debug-trycompile", "Do not delete the try compile directories..",
"Do not delete the files and directories created for try_compile calls. " "Do not delete the files and directories created for try_compile calls. "
"This is useful in debugging failed try_compiles."}, "This is useful in debugging failed try_compiles."},
{"--debug-output", "Put cmake in a debug mode.",
"Print extra stuff during the cmake run like stack traces with "
"message(send_error ) calls."},
{"--help-command cmd [file]", "Print help for a single command and exit.", {"--help-command cmd [file]", "Print help for a single command and exit.",
"Full documentation specific to the given command is displayed."}, "Full documentation specific to the given command is displayed."},
{"--help-command-list [file]", "List available listfile commands and exit.", {"--help-command-list [file]", "List available listfile commands and exit.",