diff options
author | Brad King <brad.king@kitware.com> | 2010-12-06 19:33:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-12-15 19:53:24 (GMT) |
commit | bfb7288f8103298bf4cabb60a13208f95595a7db (patch) | |
tree | 907bea44648b982fd16425dbbc90d48915e8fe7c /Source/cmCustomCommand.cxx | |
parent | 53ea8b32045ce4c8045b904407e7e57d8d9fd4ab (diff) | |
download | CMake-bfb7288f8103298bf4cabb60a13208f95595a7db.zip CMake-bfb7288f8103298bf4cabb60a13208f95595a7db.tar.gz CMake-bfb7288f8103298bf4cabb60a13208f95595a7db.tar.bz2 |
Record backtrace in cmCustomCommand
This will be used to report custom command errors to the user with a
backtrace pointing at the add_custom_command or add_custom_target call.
Diffstat (limited to 'Source/cmCustomCommand.cxx')
-rw-r--r-- | Source/cmCustomCommand.cxx | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 5db88fa..bd860ee 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmCustomCommand.h" +#include "cmMakefile.h" + //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand() { @@ -28,12 +30,14 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): Comment(r.Comment), WorkingDirectory(r.WorkingDirectory), EscapeAllowMakeVars(r.EscapeAllowMakeVars), - EscapeOldStyle(r.EscapeOldStyle) + EscapeOldStyle(r.EscapeOldStyle), + Backtrace(new cmListFileBacktrace(*r.Backtrace)) { } //---------------------------------------------------------------------------- -cmCustomCommand::cmCustomCommand(const std::vector<std::string>& outputs, +cmCustomCommand::cmCustomCommand(cmMakefile* mf, + const std::vector<std::string>& outputs, const std::vector<std::string>& depends, const cmCustomCommandLines& commandLines, const char* comment, @@ -45,10 +49,21 @@ cmCustomCommand::cmCustomCommand(const std::vector<std::string>& outputs, Comment(comment?comment:""), WorkingDirectory(workingDirectory?workingDirectory:""), EscapeAllowMakeVars(false), - EscapeOldStyle(true) + EscapeOldStyle(true), + Backtrace(new cmListFileBacktrace) { this->EscapeOldStyle = true; this->EscapeAllowMakeVars = false; + if(mf) + { + mf->GetBacktrace(*this->Backtrace); + } +} + +//---------------------------------------------------------------------------- +cmCustomCommand::~cmCustomCommand() +{ + delete this->Backtrace; } //---------------------------------------------------------------------------- @@ -131,6 +146,12 @@ void cmCustomCommand::SetEscapeAllowMakeVars(bool b) } //---------------------------------------------------------------------------- +cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const +{ + return *this->Backtrace; +} + +//---------------------------------------------------------------------------- cmCustomCommand::ImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const { |