Merge topic 'custom-command-assignment'

17c841c add_custom_command: Manage backtrace memory correctly (#14299)
This commit is contained in:
Brad King 2013-07-18 10:12:08 -04:00 committed by CMake Topic Stage
commit b28360c780
2 changed files with 29 additions and 0 deletions

View File

@ -13,6 +13,8 @@
#include "cmMakefile.h" #include "cmMakefile.h"
#include <cmsys/auto_ptr.hxx>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand() cmCustomCommand::cmCustomCommand()
{ {
@ -35,6 +37,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, cmCustomCommand::cmCustomCommand(cmMakefile* mf,
const std::vector<std::string>& outputs, const std::vector<std::string>& outputs,

View File

@ -27,6 +27,7 @@ public:
/** Default and copy constructors for STL containers. */ /** Default and copy constructors for STL containers. */
cmCustomCommand(); cmCustomCommand();
cmCustomCommand(const cmCustomCommand& r); cmCustomCommand(const cmCustomCommand& r);
cmCustomCommand& operator=(cmCustomCommand const& r);
/** Main constructor specifies all information for the command. */ /** Main constructor specifies all information for the command. */
cmCustomCommand(cmMakefile* mf, cmCustomCommand(cmMakefile* mf,