cmCTestUpdateCommand.cxx 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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(), this->Quiet);
  20. }
  21. else
  22. {
  23. this->CTest->SetCTestConfiguration("SourceDirectory",
  24. cmSystemTools::CollapseFullPath(
  25. this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY")).c_str(),
  26. this->Quiet);
  27. }
  28. std::string source_dir
  29. = this->CTest->GetCTestConfiguration("SourceDirectory");
  30. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  31. "UpdateCommand", "CTEST_UPDATE_COMMAND", this->Quiet);
  32. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  33. "UpdateOptions", "CTEST_UPDATE_OPTIONS", this->Quiet);
  34. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  35. "CVSCommand", "CTEST_CVS_COMMAND", this->Quiet);
  36. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  37. "CVSUpdateOptions", "CTEST_CVS_UPDATE_OPTIONS", this->Quiet);
  38. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  39. "SVNCommand", "CTEST_SVN_COMMAND", this->Quiet);
  40. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  41. "SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS", this->Quiet);
  42. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  43. "SVNOptions", "CTEST_SVN_OPTIONS", this->Quiet);
  44. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  45. "BZRCommand", "CTEST_BZR_COMMAND", this->Quiet);
  46. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  47. "BZRUpdateOptions", "CTEST_BZR_UPDATE_OPTIONS", this->Quiet);
  48. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  49. "GITCommand", "CTEST_GIT_COMMAND", this->Quiet);
  50. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  51. "GITUpdateOptions", "CTEST_GIT_UPDATE_OPTIONS", this->Quiet);
  52. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  53. "GITUpdateCustom", "CTEST_GIT_UPDATE_CUSTOM", this->Quiet);
  54. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  55. "UpdateVersionOnly", "CTEST_UPDATE_VERSION_ONLY", this->Quiet);
  56. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  57. "HGCommand", "CTEST_HG_COMMAND", this->Quiet);
  58. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  59. "HGUpdateOptions", "CTEST_HG_UPDATE_OPTIONS", this->Quiet);
  60. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  61. "P4Command", "CTEST_P4_COMMAND", this->Quiet);
  62. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  63. "P4UpdateOptions", "CTEST_P4_UPDATE_OPTIONS", this->Quiet);
  64. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  65. "P4Client", "CTEST_P4_CLIENT", this->Quiet);
  66. this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
  67. "P4Options", "CTEST_P4_OPTIONS", this->Quiet);
  68. cmCTestGenericHandler* handler
  69. = this->CTest->GetInitializedHandler("update");
  70. if ( !handler )
  71. {
  72. this->SetError("internal CTest error. Cannot instantiate update handler");
  73. return 0;
  74. }
  75. handler->SetCommand(this);
  76. if ( source_dir.empty() )
  77. {
  78. this->SetError("source directory not specified. Please use SOURCE tag");
  79. return 0;
  80. }
  81. handler->SetOption("SourceDirectory", source_dir.c_str());
  82. handler->SetQuiet(this->Quiet);
  83. return handler;
  84. }