cmBuildCommand.cxx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #include "cmLocalGenerator.h"
  15. #include "cmGlobalGenerator.h"
  16. // cmBuildCommand
  17. bool cmBuildCommand::InitialPass(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* define = args[0].c_str();
  25. const char* cacheValue
  26. = m_Makefile->GetDefinition(define);
  27. std::string makeprogram = args[1];
  28. std::string makecommand
  29. = m_Makefile->GetLocalGenerator()->GetGlobalGenerator()->GenerateBuildCommand(
  30. makeprogram.c_str(), m_Makefile->GetProjectName(), 0, "Release", true);
  31. #if 0
  32. std::string makecommand;
  33. if(makeprogram.find("msdev") != std::string::npos ||
  34. makeprogram.find("MSDEV") != std::string::npos )
  35. {
  36. makecommand = "\"";
  37. makecommand += makeprogram;
  38. makecommand += "\"";
  39. makecommand += " ";
  40. makecommand += m_Makefile->GetProjectName();
  41. makecommand += ".dsw /MAKE \"ALL_BUILD - Release\" ";
  42. }
  43. else if (makeprogram.find("devenv") != std::string::npos ||
  44. makeprogram.find("DEVENV") != std::string::npos )
  45. {
  46. makecommand = "\"";
  47. makecommand += makeprogram;
  48. makecommand += "\"";
  49. makecommand += " ";
  50. makecommand += m_Makefile->GetProjectName();
  51. makecommand += ".sln /build Release /project ALL_BUILD";
  52. }
  53. else if (makeprogram.find("xcodebuild") != std::string::npos)
  54. {
  55. makecommand += makeprogram;
  56. }
  57. else
  58. {
  59. makecommand = makeprogram;
  60. makecommand += " -i";
  61. }
  62. std::cerr << "-- Compare: " << makecommand.c_str() << " and " << makecmd.c_str() << ": " << (makecmd == makecommand) << std::endl;
  63. #endif
  64. if(cacheValue)
  65. {
  66. return true;
  67. }
  68. m_Makefile->AddCacheDefinition(define,
  69. makecommand.c_str(),
  70. "Command used to build entire project "
  71. "from the command line.",
  72. cmCacheManager::STRING);
  73. return true;
  74. }