cmGetTestPropertyCommand.cxx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmGetTestPropertyCommand.h"
  14. #include "cmake.h"
  15. #include "cmTest.h"
  16. // cmGetTestPropertyCommand
  17. bool cmGetTestPropertyCommand::InitialPass(
  18. std::vector<std::string> const& args)
  19. {
  20. if(args.size() < 3 )
  21. {
  22. this->SetError("called with incorrect number of arguments");
  23. return false;
  24. }
  25. std::string testName = args[0];
  26. std::string var = args[1];
  27. cmTest *test = m_Makefile->GetTest(testName.c_str());
  28. if (test)
  29. {
  30. const char *prop = test->GetProperty(args[2].c_str());
  31. if (prop)
  32. {
  33. m_Makefile->AddDefinition(var.c_str(), prop);
  34. return true;
  35. }
  36. }
  37. m_Makefile->AddDefinition(var.c_str(), "NOTFOUND");
  38. return true;
  39. }