cmTest.cxx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 "cmTest.h"
  14. #include "cmSystemTools.h"
  15. cmTest::cmTest()
  16. {
  17. }
  18. cmTest::~cmTest()
  19. {
  20. }
  21. void cmTest::SetName(const char* name)
  22. {
  23. if ( !name )
  24. {
  25. name = "";
  26. }
  27. this->Name = name;
  28. }
  29. void cmTest::SetCommand(const char* command)
  30. {
  31. if ( !command )
  32. {
  33. command = "";
  34. }
  35. this->Command = command;
  36. cmSystemTools::ConvertToUnixSlashes(this->Command);
  37. }
  38. void cmTest::SetArguments(const std::vector<cmStdString>& args)
  39. {
  40. this->Args = args;
  41. }
  42. const char *cmTest::GetProperty(const char* prop) const
  43. {
  44. std::map<cmStdString,cmStdString>::const_iterator i =
  45. this->Properties.find(prop);
  46. if (i != this->Properties.end())
  47. {
  48. return i->second.c_str();
  49. }
  50. return 0;
  51. }
  52. bool cmTest::GetPropertyAsBool(const char* prop) const
  53. {
  54. std::map<cmStdString,cmStdString>::const_iterator i =
  55. this->Properties.find(prop);
  56. if (i != this->Properties.end())
  57. {
  58. return cmSystemTools::IsOn(i->second.c_str());
  59. }
  60. return false;
  61. }
  62. void cmTest::SetProperty(const char* prop, const char* value)
  63. {
  64. if (!prop)
  65. {
  66. return;
  67. }
  68. if (!value)
  69. {
  70. value = "NOTFOUND";
  71. }
  72. this->Properties[prop] = value;
  73. }