2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2005-07-31 15:51:42 +00:00
|
|
|
#include "cmGetTestPropertyCommand.h"
|
|
|
|
|
2016-10-25 18:35:04 +00:00
|
|
|
#include "cmMakefile.h"
|
2005-07-31 15:51:42 +00:00
|
|
|
#include "cmTest.h"
|
2016-10-25 18:35:04 +00:00
|
|
|
|
|
|
|
class cmExecutionStatus;
|
2005-07-31 15:51:42 +00:00
|
|
|
|
|
|
|
// cmGetTestPropertyCommand
|
2016-05-16 14:34:04 +00:00
|
|
|
bool cmGetTestPropertyCommand::InitialPass(
|
|
|
|
std::vector<std::string> const& args, cmExecutionStatus&)
|
2005-07-31 15:51:42 +00:00
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
if (args.size() < 3) {
|
2005-07-31 15:51:42 +00:00
|
|
|
this->SetError("called with incorrect number of arguments");
|
|
|
|
return false;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2005-07-31 15:51:42 +00:00
|
|
|
|
|
|
|
std::string testName = args[0];
|
2005-09-18 12:17:39 +00:00
|
|
|
std::string var = args[2];
|
2016-05-16 14:34:04 +00:00
|
|
|
cmTest* test = this->Makefile->GetTest(testName);
|
|
|
|
if (test) {
|
2016-06-27 20:44:16 +00:00
|
|
|
const char* prop = CM_NULLPTR;
|
2016-05-16 14:34:04 +00:00
|
|
|
if (!args[1].empty()) {
|
2015-06-06 07:41:20 +00:00
|
|
|
prop = test->GetProperty(args[1]);
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
|
|
|
if (prop) {
|
2014-03-10 23:04:11 +00:00
|
|
|
this->Makefile->AddDefinition(var, prop);
|
2005-07-31 15:51:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2014-03-10 23:04:11 +00:00
|
|
|
this->Makefile->AddDefinition(var, "NOTFOUND");
|
2005-07-31 15:51:42 +00:00
|
|
|
return true;
|
|
|
|
}
|