2016-10-30 18:24:19 +01:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2008-10-12 18:41:06 +02:00
|
|
|
#include "cmGetTestPropertyCommand.h"
|
|
|
|
|
2017-04-14 19:02:05 +02:00
|
|
|
#include "cmMakefile.h"
|
2008-10-12 18:41:06 +02:00
|
|
|
#include "cmTest.h"
|
2017-04-14 19:02:05 +02:00
|
|
|
|
|
|
|
class cmExecutionStatus;
|
2008-10-12 18:41:06 +02:00
|
|
|
|
|
|
|
// cmGetTestPropertyCommand
|
2016-07-09 11:21:54 +02:00
|
|
|
bool cmGetTestPropertyCommand::InitialPass(
|
|
|
|
std::vector<std::string> const& args, cmExecutionStatus&)
|
2008-10-12 18:41:06 +02:00
|
|
|
{
|
2016-07-09 11:21:54 +02:00
|
|
|
if (args.size() < 3) {
|
2008-10-12 18:41:06 +02:00
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
2016-07-09 11:21:54 +02:00
|
|
|
}
|
2008-10-12 18:41:06 +02:00
|
|
|
|
2017-07-20 19:35:53 +02:00
|
|
|
std::string const& testName = args[0];
|
|
|
|
std::string const& var = args[2];
|
2016-07-09 11:21:54 +02:00
|
|
|
cmTest* test = this->Makefile->GetTest(testName);
|
|
|
|
if (test) {
|
2018-01-26 17:06:56 +01:00
|
|
|
const char* prop = nullptr;
|
2016-07-09 11:21:54 +02:00
|
|
|
if (!args[1].empty()) {
|
2015-11-17 17:22:37 +01:00
|
|
|
prop = test->GetProperty(args[1]);
|
2016-07-09 11:21:54 +02:00
|
|
|
}
|
|
|
|
if (prop) {
|
2015-04-27 22:25:09 +02:00
|
|
|
this->Makefile->AddDefinition(var, prop);
|
2008-10-12 18:41:06 +02:00
|
|
|
return true;
|
|
|
|
}
|
2016-07-09 11:21:54 +02:00
|
|
|
}
|
2015-04-27 22:25:09 +02:00
|
|
|
this->Makefile->AddDefinition(var, "NOTFOUND");
|
2008-10-12 18:41:06 +02:00
|
|
|
return true;
|
|
|
|
}
|