cmGlobalMinGWMakefileGenerator.cxx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 "cmGlobalMinGWMakefileGenerator.h"
  14. #include "cmLocalUnixMakefileGenerator3.h"
  15. #include "cmMakefile.h"
  16. cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator()
  17. {
  18. this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
  19. this->ForceUnixPaths = true;
  20. this->ToolSupportsColorVT100 = false;
  21. }
  22. void cmGlobalMinGWMakefileGenerator::EnableLanguage(std::vector<std::string>const& l,
  23. cmMakefile *mf)
  24. {
  25. this->FindMakeProgram(mf);
  26. std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
  27. std::vector<std::string> locations;
  28. locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str()));
  29. locations.push_back("/mingw/bin");
  30. locations.push_back("c:/mingw/bin");
  31. std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
  32. std::string gcc = "gcc.exe";
  33. if(tgcc.size())
  34. {
  35. gcc = tgcc;
  36. }
  37. std::string tgxx = cmSystemTools::FindProgram("g++", locations);
  38. std::string gxx = "g++.exe";
  39. if(tgxx.size())
  40. {
  41. gxx = tgxx;
  42. }
  43. mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
  44. mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
  45. this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf);
  46. }
  47. ///! Create a local generator appropriate to this Global Generator
  48. cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
  49. {
  50. cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
  51. lg->SetWindowsShell(true);
  52. lg->SetGlobalGenerator(this);
  53. lg->SetIgnoreLibPrefix(true);
  54. lg->SetPassMakeflags(false);
  55. lg->SetUnixCD(true);
  56. return lg;
  57. }
  58. //----------------------------------------------------------------------------
  59. void cmGlobalMinGWMakefileGenerator::GetDocumentation(cmDocumentationEntry& entry) const
  60. {
  61. entry.name = this->GetName();
  62. entry.brief = "Generates a make file for use with mingw32-make.";
  63. entry.full = "The makefiles generated use cmd.exe as the shell. "
  64. "They do not require msys or a unix shell.";
  65. }