cmGetTestPropertyCommand.cxx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmGetTestPropertyCommand.h"
  11. #include "cmake.h"
  12. #include "cmTest.h"
  13. // cmGetTestPropertyCommand
  14. bool cmGetTestPropertyCommand
  15. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  16. {
  17. if(args.size() < 3 )
  18. {
  19. this->SetError("called with incorrect number of arguments");
  20. return false;
  21. }
  22. std::string testName = args[0];
  23. std::string var = args[2];
  24. cmTest *test = this->Makefile->GetTest(testName);
  25. if (test)
  26. {
  27. const char *prop = test->GetProperty(args[1]);
  28. if (prop)
  29. {
  30. this->Makefile->AddDefinition(var, prop);
  31. return true;
  32. }
  33. }
  34. this->Makefile->AddDefinition(var, "NOTFOUND");
  35. return true;
  36. }