summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-07-18 14:12:08 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-07-18 14:12:08 (GMT)
commitb28360c780d892101522c2c5b34d2ad21520bf1e (patch)
tree6e0cd523c5d5a618d2238e36bee6ae9ad7fcb4e8
parent5b3ea27f97dc4656aaf0a4da802ac7423fb4b972 (diff)
parent17c841c42d69987c84940232428928c39f1637cd (diff)
downloadCMake-b28360c780d892101522c2c5b34d2ad21520bf1e.zip
CMake-b28360c780d892101522c2c5b34d2ad21520bf1e.tar.gz
CMake-b28360c780d892101522c2c5b34d2ad21520bf1e.tar.bz2
Merge topic 'custom-command-assignment'
17c841c add_custom_command: Manage backtrace memory correctly (#14299)
-rw-r--r--Source/cmCustomCommand.cxx28
-rw-r--r--Source/cmCustomCommand.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index bd860ee..3620a38 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -13,6 +13,8 @@
#include "cmMakefile.h"
+#include <cmsys/auto_ptr.hxx>
+
//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand()
{
@@ -36,6 +38,32 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
}
//----------------------------------------------------------------------------
+cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r)
+{
+ if(this == &r)
+ {
+ return *this;
+ }
+
+ this->Outputs = r.Outputs;
+ this->Depends = r.Depends;
+ this->CommandLines = r.CommandLines;
+ this->HaveComment = r.HaveComment;
+ this->Comment = r.Comment;
+ this->WorkingDirectory = r.WorkingDirectory;
+ this->EscapeAllowMakeVars = r.EscapeAllowMakeVars;
+ this->EscapeOldStyle = r.EscapeOldStyle;
+ this->ImplicitDepends = r.ImplicitDepends;
+
+ cmsys::auto_ptr<cmListFileBacktrace>
+ newBacktrace(new cmListFileBacktrace(*r.Backtrace));
+ delete this->Backtrace;
+ this->Backtrace = newBacktrace.release();
+
+ return *this;
+}
+
+//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand(cmMakefile* mf,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index dd92e34..e20d2bf 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -27,6 +27,7 @@ public:
/** Default and copy constructors for STL containers. */
cmCustomCommand();
cmCustomCommand(const cmCustomCommand& r);
+ cmCustomCommand& operator=(cmCustomCommand const& r);
/** Main constructor specifies all information for the command. */
cmCustomCommand(cmMakefile* mf,