cmGetTestPropertyCommand.cxx 915 B

12345678910111213141516171819202122232425262728293031323334
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmGetTestPropertyCommand.h"
  4. #include "cmMakefile.h"
  5. #include "cmTest.h"
  6. class cmExecutionStatus;
  7. // cmGetTestPropertyCommand
  8. bool cmGetTestPropertyCommand::InitialPass(
  9. std::vector<std::string> const& args, cmExecutionStatus&)
  10. {
  11. if (args.size() < 3) {
  12. this->SetError("called with incorrect number of arguments");
  13. return false;
  14. }
  15. std::string const& testName = args[0];
  16. std::string const& var = args[2];
  17. cmTest* test = this->Makefile->GetTest(testName);
  18. if (test) {
  19. const char* prop = nullptr;
  20. if (!args[1].empty()) {
  21. prop = test->GetProperty(args[1]);
  22. }
  23. if (prop) {
  24. this->Makefile->AddDefinition(var, prop);
  25. return true;
  26. }
  27. }
  28. this->Makefile->AddDefinition(var, "NOTFOUND");
  29. return true;
  30. }