cmGlobalMinGWMakefileGenerator.cxx 2.6 KB

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