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