From 017cec95ada69369e3959cc9c09248335ea2dbfa Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 6 Oct 2006 11:11:59 -0400 Subject: ENH: do not print a call stack if the user does a message error unless --debug-output is used --- Source/cmMessageCommand.cxx | 17 ++++++++++++++--- Source/cmake.cxx | 6 ++++++ Source/cmake.h | 6 +++++- Source/cmakemain.cxx | 3 +++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 7ab17fb..266bcf8 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -59,8 +59,14 @@ bool cmMessageCommand::InitialPass(std::vector const& args) if (send_error || fatal_error) { - //cmSystemTools::Error(message.c_str()); - this->SetError(message.c_str()); + if( !this->Makefile->GetCMakeInstance()->GetDebugOutput()) + { + cmSystemTools::Error(message.c_str()); + } + else + { + this->SetError(message.c_str()); + } } else { @@ -77,6 +83,11 @@ bool cmMessageCommand::InitialPass(std::vector const& args) { 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; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8636aa0..c1ca881 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -111,6 +111,7 @@ void cmNeedBackwardsCompatibility(const std::string& variable, cmake::cmake() { + this->DebugOutput = false; this->DebugTryCompile = false; this->ClearBuildSystem = false; this->FileComparison = new cmFileTimeComparison; @@ -446,6 +447,11 @@ void cmake::SetArgs(const std::vector& args) std::cout << "debug trycompile on\n"; 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) { std::string value = arg.substr(2); diff --git a/Source/cmake.h b/Source/cmake.h index d63cf7e..643dfec 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -281,6 +281,9 @@ class cmake const char* GetCPackCommand(); 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: typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)(); typedef std::map& args); cmVariableWatch* VariableWatch; - + private: ProgressCallbackType ProgressCallback; void* ProgressCallbackClientData; bool Verbose; bool InTryCompile; bool ScriptMode; + bool DebugOutput; std::string CMakeCommand; std::string CXXEnvironment; std::string CCEnvironment; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 1a5d2db..f183ae2 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -85,6 +85,9 @@ static const cmDocumentationEntry cmDocumentationOptions[] = {"--debug-trycompile", "Do not delete the try compile directories..", "Do not delete the files and directories created for try_compile calls. " "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.", "Full documentation specific to the given command is displayed."}, {"--help-command-list [file]", "List available listfile commands and exit.", -- cgit v0.12