1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 20:46:37 +08:00

ENH: New format for warning and error messages

- Add cmMakefile methods IssueError and IssueWarning
  - Maintain an explicit call stack in cmMakefile
  - Include context/call-stack info in messages
  - Nested errors now unwind the call stack
  - Use new mechanism for policy warnings and errors
  - Improve policy error message
  - Include cmExecutionStatus pointer in call stack
    so that errors deeper in the C++ stack under
    a command invocation will become errors for the
    command
This commit is contained in:
Brad King
2008-03-07 08:40:36 -05:00
parent 41a59e211e
commit 680104a490
9 changed files with 234 additions and 109 deletions

View File

@@ -86,7 +86,7 @@ public:
bool cmFunctionHelperCommand::InvokeInitialPass
(const std::vector<cmListFileArgument>& args,
cmExecutionStatus &)
cmExecutionStatus & inStatus)
{
// Expand the argument list to the function.
std::vector<std::string> expandedArgs;
@@ -157,18 +157,12 @@ bool cmFunctionHelperCommand::InvokeInitialPass
for(unsigned int c = 0; c < this->Functions.size(); ++c)
{
cmExecutionStatus status;
if (!this->Makefile->ExecuteCommand(this->Functions[c],status))
if (!this->Makefile->ExecuteCommand(this->Functions[c],status) ||
status.GetNestedError())
{
cmOStringStream error;
error << "Error in cmake code at\n"
<< this->Functions[c].FilePath << ":"
<< this->Functions[c].Line << ":\n"
<< "A command failed during the invocation of function \""
<< this->Args[0].c_str() << "\".";
cmSystemTools::Error(error.str().c_str());
// pop scope on the makefile and return
this->Makefile->PopScope();
// The error message should have already included the call stack
// so we do not need to report an error here.
inStatus.SetNestedError(true);
return false;
}
if (status.GetReturnInvoked())