cmake/Source/cmCustomCommand.cxx

158 lines
5.0 KiB
C++
Raw Normal View History

2009-10-04 10:30:41 +03:00
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
2009-10-04 10:30:41 +03:00
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
2009-10-04 10:30:41 +03:00
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmCustomCommand.h"
2011-01-16 11:35:12 +01:00
#include "cmMakefile.h"
2013-11-03 12:27:13 +02:00
#include <cmsys/auto_ptr.hxx>
//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand()
2015-11-17 17:22:37 +01:00
: Backtrace()
{
this->HaveComment = false;
this->EscapeOldStyle = true;
this->EscapeAllowMakeVars = false;
2015-04-27 22:25:09 +02:00
this->UsesTerminal = false;
}
2013-11-03 12:27:13 +02:00
//----------------------------------------------------------------------------
2014-08-03 19:52:23 +02:00
cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
2011-01-16 11:35:12 +01:00
const std::vector<std::string>& outputs,
2015-04-27 22:25:09 +02:00
const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
const char* comment,
const char* workingDirectory):
Outputs(outputs),
2015-04-27 22:25:09 +02:00
Byproducts(byproducts),
Depends(depends),
CommandLines(commandLines),
2015-11-17 17:22:37 +01:00
Backtrace(),
Comment(comment?comment:""),
WorkingDirectory(workingDirectory?workingDirectory:""),
2015-11-17 17:22:37 +01:00
HaveComment(comment?true:false),
EscapeAllowMakeVars(false),
2015-11-17 17:22:37 +01:00
EscapeOldStyle(true)
{
2011-01-16 11:35:12 +01:00
if(mf)
{
2015-04-27 22:25:09 +02:00
this->Backtrace = mf->GetBacktrace();
2011-01-16 11:35:12 +01:00
}
}
//----------------------------------------------------------------------------
const std::vector<std::string>& cmCustomCommand::GetOutputs() const
{
return this->Outputs;
}
//----------------------------------------------------------------------------
2015-04-27 22:25:09 +02:00
const std::vector<std::string>& cmCustomCommand::GetByproducts() const
{
2015-04-27 22:25:09 +02:00
return this->Byproducts;
}
//----------------------------------------------------------------------------
const std::vector<std::string>& cmCustomCommand::GetDepends() const
{
return this->Depends;
}
//----------------------------------------------------------------------------
const cmCustomCommandLines& cmCustomCommand::GetCommandLines() const
{
return this->CommandLines;
}
//----------------------------------------------------------------------------
const char* cmCustomCommand::GetComment() const
{
const char* no_comment = 0;
return this->HaveComment? this->Comment.c_str() : no_comment;
}
//----------------------------------------------------------------------------
void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
{
2015-04-27 22:25:09 +02:00
this->CommandLines.insert(this->CommandLines.end(),
commandLines.begin(), commandLines.end());
}
//----------------------------------------------------------------------------
void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
{
2015-04-27 22:25:09 +02:00
this->Depends.insert(this->Depends.end(), depends.begin(), depends.end());
}
//----------------------------------------------------------------------------
bool cmCustomCommand::GetEscapeOldStyle() const
{
return this->EscapeOldStyle;
}
//----------------------------------------------------------------------------
void cmCustomCommand::SetEscapeOldStyle(bool b)
{
this->EscapeOldStyle = b;
}
//----------------------------------------------------------------------------
bool cmCustomCommand::GetEscapeAllowMakeVars() const
{
return this->EscapeAllowMakeVars;
}
//----------------------------------------------------------------------------
void cmCustomCommand::SetEscapeAllowMakeVars(bool b)
{
this->EscapeAllowMakeVars = b;
}
2011-01-16 11:35:12 +01:00
//----------------------------------------------------------------------------
cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const
{
2015-04-27 22:25:09 +02:00
return this->Backtrace;
2011-01-16 11:35:12 +01:00
}
//----------------------------------------------------------------------------
cmCustomCommand::ImplicitDependsList const&
cmCustomCommand::GetImplicitDepends() const
{
return this->ImplicitDepends;
}
//----------------------------------------------------------------------------
void cmCustomCommand::SetImplicitDepends(ImplicitDependsList const& l)
{
this->ImplicitDepends = l;
}
//----------------------------------------------------------------------------
void cmCustomCommand::AppendImplicitDepends(ImplicitDependsList const& l)
{
this->ImplicitDepends.insert(this->ImplicitDepends.end(),
l.begin(), l.end());
}
2015-04-27 22:25:09 +02:00
//----------------------------------------------------------------------------
bool cmCustomCommand::GetUsesTerminal() const
{
return this->UsesTerminal;
}
//----------------------------------------------------------------------------
void cmCustomCommand::SetUsesTerminal(bool b)
{
this->UsesTerminal = b;
}