cmGlobalMinGWMakefileGenerator.cxx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmGlobalMinGWMakefileGenerator.h"
  11. #include "cmLocalUnixMakefileGenerator3.h"
  12. #include "cmMakefile.h"
  13. cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
  14. : cmGlobalUnixMakefileGenerator3(cm)
  15. {
  16. this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
  17. this->ForceUnixPaths = true;
  18. this->ToolSupportsColor = true;
  19. this->UseLinkScript = true;
  20. cm->GetState()->SetWindowsShell(true);
  21. cm->GetState()->SetMinGWMake(true);
  22. }
  23. void cmGlobalMinGWMakefileGenerator
  24. ::EnableLanguage(std::vector<std::string>const& l,
  25. cmMakefile *mf,
  26. bool optional)
  27. {
  28. this->FindMakeProgram(mf);
  29. std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
  30. std::vector<std::string> locations;
  31. locations.push_back(cmSystemTools::GetProgramPath(makeProgram));
  32. locations.push_back("/mingw/bin");
  33. locations.push_back("c:/mingw/bin");
  34. std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
  35. std::string gcc = "gcc.exe";
  36. if(!tgcc.empty())
  37. {
  38. gcc = tgcc;
  39. }
  40. std::string tgxx = cmSystemTools::FindProgram("g++", locations);
  41. std::string gxx = "g++.exe";
  42. if(!tgxx.empty())
  43. {
  44. gxx = tgxx;
  45. }
  46. std::string trc = cmSystemTools::FindProgram("windres", locations);
  47. std::string rc = "windres.exe";
  48. if(!trc.empty())
  49. {
  50. rc = trc;
  51. }
  52. mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
  53. mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
  54. mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str());
  55. this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
  56. }
  57. //----------------------------------------------------------------------------
  58. void cmGlobalMinGWMakefileGenerator
  59. ::GetDocumentation(cmDocumentationEntry& entry)
  60. {
  61. entry.Name = cmGlobalMinGWMakefileGenerator::GetActualName();
  62. entry.Brief = "Generates a make file for use with mingw32-make.";
  63. }