cmBuildCommand.cxx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 "cmBuildCommand.h"
  14. // cmBuildCommand
  15. bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
  16. {
  17. if(args.size() < 2 )
  18. {
  19. this->SetError("called with incorrect number of arguments");
  20. return false;
  21. }
  22. const char* define = args[0].c_str();
  23. const char* cacheValue
  24. = m_Makefile->GetDefinition(define);
  25. if(cacheValue)
  26. {
  27. return true;
  28. }
  29. std::string makecommand;
  30. std::string makeprogram = args[1];
  31. if(makeprogram.find("msdev") != std::string::npos ||
  32. makeprogram.find("MSDEV") != std::string::npos )
  33. {
  34. makecommand = "\"";
  35. makecommand += makeprogram;
  36. makecommand += "\"";
  37. makecommand += " ";
  38. makecommand += m_Makefile->GetProjectName();
  39. makecommand += ".dsw /MAKE \"ALL_BUILD - Release\" ";
  40. }
  41. else if (makeprogram.find("devenv") != std::string::npos ||
  42. makeprogram.find("DEVENV") != std::string::npos )
  43. {
  44. makecommand = "\"";
  45. makecommand += makeprogram;
  46. makecommand += "\"";
  47. makecommand += " ";
  48. makecommand += m_Makefile->GetProjectName();
  49. makecommand += ".sln /build Release /project ALL_BUILD";
  50. }
  51. else if (makeprogram.find("xcodebuild") != std::string::npos)
  52. {
  53. makecommand += makeprogram;
  54. }
  55. else
  56. {
  57. makecommand = makeprogram;
  58. makecommand += " -i";
  59. }
  60. m_Makefile->AddCacheDefinition(define,
  61. makecommand.c_str(),
  62. "Command used to build entire project "
  63. "from the command line.",
  64. cmCacheManager::STRING);
  65. return true;
  66. }