cmCTestCoverageCommand.cxx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 "cmCTestCoverageCommand.h"
  14. #include "cmCTest.h"
  15. #include "cmCTestCoverageHandler.h"
  16. //----------------------------------------------------------------------------
  17. cmCTestCoverageCommand::cmCTestCoverageCommand()
  18. {
  19. this->LabelsMentioned = false;
  20. }
  21. //----------------------------------------------------------------------------
  22. cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
  23. {
  24. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  25. "CoverageCommand", "CTEST_COVERAGE_COMMAND");
  26. cmCTestCoverageHandler* handler = static_cast<cmCTestCoverageHandler*>(
  27. this->CTest->GetInitializedHandler("coverage"));
  28. if ( !handler )
  29. {
  30. this->SetError("internal CTest error. Cannot instantiate test handler");
  31. return 0;
  32. }
  33. // If a LABELS option was given, select only files with the labels.
  34. if(this->LabelsMentioned)
  35. {
  36. handler->SetLabelFilter(this->Labels);
  37. }
  38. return handler;
  39. }
  40. //----------------------------------------------------------------------------
  41. bool cmCTestCoverageCommand::CheckArgumentKeyword(std::string const& arg)
  42. {
  43. // Look for arguments specific to this command.
  44. if(arg == "LABELS")
  45. {
  46. this->ArgumentDoing = ArgumentDoingLabels;
  47. this->LabelsMentioned = true;
  48. return true;
  49. }
  50. // Look for other arguments.
  51. return this->Superclass::CheckArgumentKeyword(arg);
  52. }
  53. //----------------------------------------------------------------------------
  54. bool cmCTestCoverageCommand::CheckArgumentValue(std::string const& arg)
  55. {
  56. // Handle states specific to this command.
  57. if(this->ArgumentDoing == ArgumentDoingLabels)
  58. {
  59. this->Labels.insert(arg);
  60. return true;
  61. }
  62. // Look for other arguments.
  63. return this->Superclass::CheckArgumentValue(arg);
  64. }