cmBuildCommand.cxx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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. m_Makefile->ExpandVariablesInString(makeprogram);
  32. if(makeprogram.find("msdev") != std::string::npos ||
  33. makeprogram.find("MSDEV") != std::string::npos )
  34. {
  35. makecommand = "\"";
  36. makecommand += makeprogram;
  37. makecommand += "\"";
  38. makecommand += " ";
  39. makecommand += m_Makefile->GetProjectName();
  40. makecommand += ".dsw /MAKE \"ALL_BUILD - Release\" ";
  41. }
  42. else if(m_Makefile->GetDefinition("BORLAND"))
  43. {
  44. makecommand = makeprogram;
  45. makecommand += " -i";
  46. }
  47. else
  48. {
  49. makecommand = makeprogram;
  50. makecommand += " -i";
  51. }
  52. m_Makefile->AddCacheDefinition(define,
  53. makecommand.c_str(),
  54. "Command used to build entire project "
  55. "from the command line.",
  56. cmCacheManager::STRING);
  57. return true;
  58. }