2009-09-28 11:43:28 -04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2005-04-24 15:59:51 -04:00
|
|
|
|
2009-09-28 11:43:28 -04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2005-04-24 15:59:51 -04:00
|
|
|
|
2009-09-28 11:43:28 -04: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.
|
|
|
|
============================================================================*/
|
2005-04-24 15:59:51 -04:00
|
|
|
#include "cmTest.h"
|
|
|
|
#include "cmSystemTools.h"
|
|
|
|
|
2006-12-07 09:45:32 -05:00
|
|
|
#include "cmake.h"
|
|
|
|
#include "cmMakefile.h"
|
2005-04-24 15:59:51 -04:00
|
|
|
|
2009-04-03 11:41:33 -04:00
|
|
|
//----------------------------------------------------------------------------
|
2009-08-11 09:07:28 -04:00
|
|
|
cmTest::cmTest(cmMakefile* mf)
|
2005-04-24 15:59:51 -04:00
|
|
|
{
|
2009-08-11 09:07:28 -04:00
|
|
|
this->Makefile = mf;
|
2009-03-16 10:51:30 -04:00
|
|
|
this->OldStyle = true;
|
2009-08-11 09:07:28 -04:00
|
|
|
this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
|
|
|
|
this->Backtrace = new cmListFileBacktrace;
|
|
|
|
this->Makefile->GetBacktrace(*this->Backtrace);
|
2005-04-24 15:59:51 -04:00
|
|
|
}
|
|
|
|
|
2009-04-03 11:41:33 -04:00
|
|
|
//----------------------------------------------------------------------------
|
2005-04-24 15:59:51 -04:00
|
|
|
cmTest::~cmTest()
|
|
|
|
{
|
2009-08-11 09:07:28 -04:00
|
|
|
delete this->Backtrace;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
cmListFileBacktrace const& cmTest::GetBacktrace() const
|
|
|
|
{
|
|
|
|
return *this->Backtrace;
|
2005-04-24 15:59:51 -04:00
|
|
|
}
|
|
|
|
|
2009-04-03 11:41:33 -04:00
|
|
|
//----------------------------------------------------------------------------
|
2005-04-24 15:59:51 -04:00
|
|
|
void cmTest::SetName(const char* name)
|
|
|
|
{
|
|
|
|
if ( !name )
|
|
|
|
{
|
|
|
|
name = "";
|
|
|
|
}
|
2006-03-15 11:02:08 -05:00
|
|
|
this->Name = name;
|
2005-04-24 15:59:51 -04:00
|
|
|
}
|
|
|
|
|
2009-04-03 11:41:33 -04:00
|
|
|
//----------------------------------------------------------------------------
|
2009-03-16 10:42:40 -04:00
|
|
|
void cmTest::SetCommand(std::vector<std::string> const& command)
|
2005-04-24 15:59:51 -04:00
|
|
|
{
|
2006-03-15 11:02:08 -05:00
|
|
|
this->Command = command;
|
2005-04-24 15:59:51 -04:00
|
|
|
}
|
|
|
|
|
2009-04-03 11:41:33 -04:00
|
|
|
//----------------------------------------------------------------------------
|
2005-07-31 11:51:42 -04:00
|
|
|
const char *cmTest::GetProperty(const char* prop) const
|
|
|
|
{
|
2006-12-07 09:45:32 -05:00
|
|
|
bool chain = false;
|
2012-08-13 13:42:58 -04:00
|
|
|
const char *retVal =
|
2006-12-07 09:45:32 -05:00
|
|
|
this->Properties.GetPropertyValue(prop, cmProperty::TEST, chain);
|
|
|
|
if (chain)
|
2005-07-31 11:51:42 -04:00
|
|
|
{
|
2006-12-07 09:45:32 -05:00
|
|
|
return this->Makefile->GetProperty(prop,cmProperty::TEST);
|
2005-07-31 11:51:42 -04:00
|
|
|
}
|
2006-12-07 10:22:19 -05:00
|
|
|
return retVal;
|
2005-07-31 11:51:42 -04:00
|
|
|
}
|
|
|
|
|
2009-04-03 11:41:33 -04:00
|
|
|
//----------------------------------------------------------------------------
|
2005-07-31 11:51:42 -04:00
|
|
|
bool cmTest::GetPropertyAsBool(const char* prop) const
|
|
|
|
{
|
2006-12-07 09:45:32 -05:00
|
|
|
return cmSystemTools::IsOn(this->GetProperty(prop));
|
2005-07-31 11:51:42 -04:00
|
|
|
}
|
|
|
|
|
2009-04-03 11:41:33 -04:00
|
|
|
//----------------------------------------------------------------------------
|
2005-07-31 11:51:42 -04:00
|
|
|
void cmTest::SetProperty(const char* prop, const char* value)
|
|
|
|
{
|
|
|
|
if (!prop)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2006-12-07 09:45:32 -05:00
|
|
|
|
|
|
|
this->Properties.SetProperty(prop, value, cmProperty::TEST);
|
|
|
|
}
|
|
|
|
|
2008-01-17 18:13:55 -05:00
|
|
|
//----------------------------------------------------------------------------
|
2011-07-13 23:14:41 +02:00
|
|
|
void cmTest::AppendProperty(const char* prop, const char* value, bool asString)
|
2008-01-17 18:13:55 -05:00
|
|
|
{
|
|
|
|
if (!prop)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2011-07-13 23:14:41 +02:00
|
|
|
this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString);
|
2008-01-17 18:13:55 -05:00
|
|
|
}
|