cmCTestUpdateCommand.cxx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 "cmCTestUpdateCommand.h"
  11. #include "cmCTest.h"
  12. #include "cmCTestGenericHandler.h"
  13. cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
  14. {
  15. if ( this->Values[ct_SOURCE] )
  16. {
  17. this->CTest->SetCTestConfiguration("SourceDirectory",
  18. cmSystemTools::CollapseFullPath(
  19. this->Values[ct_SOURCE]).c_str());
  20. }
  21. else
  22. {
  23. this->CTest->SetCTestConfiguration("SourceDirectory",
  24. cmSystemTools::CollapseFullPath(
  25. this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY")).c_str());
  26. }
  27. std::string source_dir
  28. = this->CTest->GetCTestConfiguration("SourceDirectory");
  29. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  30. "UpdateCommand", "CTEST_UPDATE_COMMAND");
  31. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  32. "UpdateOptions", "CTEST_UPDATE_OPTIONS");
  33. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  34. "CVSCommand", "CTEST_CVS_COMMAND");
  35. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  36. "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS");
  37. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  38. "SVNCommand", "CTEST_SVN_COMMAND");
  39. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  40. "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS");
  41. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  42. "BZRCommand", "CTEST_BZR_COMMAND");
  43. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  44. "BZRUpdateOptions", "CTEST_BZR_UPDATE_OPTIONS");
  45. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  46. "GITCommand", "CTEST_GIT_COMMAND");
  47. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  48. "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS");
  49. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  50. "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM");
  51. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  52. "HGCommand", "CTEST_HG_COMMAND");
  53. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  54. "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS");
  55. cmCTestGenericHandler* handler
  56. = this->CTest->GetInitializedHandler("update");
  57. if ( !handler )
  58. {
  59. this->SetError("internal CTest error. Cannot instantiate update handler");
  60. return 0;
  61. }
  62. handler->SetCommand(this);
  63. if ( source_dir.empty() )
  64. {
  65. this->SetError("source directory not specified. Please use SOURCE tag");
  66. return 0;
  67. }
  68. handler->SetOption("SourceDirectory", source_dir.c_str());
  69. return handler;
  70. }