cmCTestUpdateCommand.cxx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 "cmCTestUpdateCommand.h"
  14. #include "cmCTest.h"
  15. #include "cmCTestGenericHandler.h"
  16. bool cmCTestUpdateCommand::InitialPass(
  17. std::vector<std::string> const& args)
  18. {
  19. if (args.size() != 2)
  20. {
  21. this->SetError("called with incorrect number of arguments");
  22. return false;
  23. }
  24. const char* source_dir = args[0].c_str();
  25. const char* res_var = args[1].c_str();
  26. m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "CVSCommand", "CTEST_CVS_COMMAND");
  27. m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "SVNCommand", "CTEST_SVN_COMMAND");
  28. cmCTestGenericHandler* handler = m_CTest->GetHandler("update");
  29. if ( !handler )
  30. {
  31. this->SetError("internal CTest error. Cannot instantiate update handler");
  32. return false;
  33. }
  34. handler->SetOption("SourceDirectory", source_dir);
  35. int res = handler->ProcessHandler();
  36. cmOStringStream str;
  37. str << res;
  38. m_Makefile->AddDefinition(res_var, str.str().c_str());
  39. return true;
  40. }