https://github.com/Kitware/CMake
Revision 00a2dc4d2f7bb5dcf2a4654863d7f74a3acb6676 authored by Kitware Robot on 11 September 2021, 04:01:17 UTC, committed by Kitware Robot on 11 September 2021, 04:01:17 UTC
1 parent 9488f8a
Raw File
Tip revision: 00a2dc4d2f7bb5dcf2a4654863d7f74a3acb6676 authored by Kitware Robot on 11 September 2021, 04:01:17 UTC
CMake Nightly Date Stamp
Tip revision: 00a2dc4
cmTest.cxx
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
#include "cmTest.h"

#include "cmMakefile.h"
#include "cmProperty.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"

cmTest::cmTest(cmMakefile* mf)
  : CommandExpandLists(false)
  , Backtrace(mf->GetBacktrace())
{
  this->Makefile = mf;
  this->OldStyle = true;
}

cmTest::~cmTest() = default;

cmListFileBacktrace const& cmTest::GetBacktrace() const
{
  return this->Backtrace;
}

void cmTest::SetName(const std::string& name)
{
  this->Name = name;
}

void cmTest::SetCommand(std::vector<std::string> const& command)
{
  this->Command = command;
}

cmProp cmTest::GetProperty(const std::string& prop) const
{
  cmProp retVal = this->Properties.GetPropertyValue(prop);
  if (!retVal) {
    const bool chain =
      this->Makefile->GetState()->IsPropertyChained(prop, cmProperty::TEST);
    if (chain) {
      if (cmProp p = this->Makefile->GetProperty(prop, chain)) {
        return p;
      }
    }
    return nullptr;
  }
  return retVal;
}

bool cmTest::GetPropertyAsBool(const std::string& prop) const
{
  return cmIsOn(this->GetProperty(prop));
}

void cmTest::SetProperty(const std::string& prop, const char* value)
{
  this->Properties.SetProperty(prop, value);
}
void cmTest::SetProperty(const std::string& prop, cmProp value)
{
  this->Properties.SetProperty(prop, value);
}

void cmTest::AppendProperty(const std::string& prop, const std::string& value,
                            bool asString)
{
  this->Properties.AppendProperty(prop, value, asString);
}

bool cmTest::GetCommandExpandLists() const
{
  return this->CommandExpandLists;
}

void cmTest::SetCommandExpandLists(bool b)
{
  this->CommandExpandLists = b;
}
back to top