cmGlobalMinGWMakefileGenerator.cxx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmGlobalMinGWMakefileGenerator.h"
  4. #include "cmLocalUnixMakefileGenerator3.h"
  5. #include "cmMakefile.h"
  6. #include "cmState.h"
  7. cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
  8. : cmGlobalUnixMakefileGenerator3(cm)
  9. {
  10. this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
  11. this->ForceUnixPaths = true;
  12. this->ToolSupportsColor = true;
  13. this->UseLinkScript = true;
  14. cm->GetState()->SetWindowsShell(true);
  15. cm->GetState()->SetMinGWMake(true);
  16. }
  17. void cmGlobalMinGWMakefileGenerator::EnableLanguage(
  18. std::vector<std::string> const& l, cmMakefile* mf, bool optional)
  19. {
  20. this->FindMakeProgram(mf);
  21. std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
  22. std::vector<std::string> locations;
  23. locations.push_back(cmSystemTools::GetProgramPath(makeProgram));
  24. locations.push_back("/mingw/bin");
  25. locations.push_back("c:/mingw/bin");
  26. std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
  27. std::string gcc = "gcc.exe";
  28. if (!tgcc.empty()) {
  29. gcc = tgcc;
  30. }
  31. std::string tgxx = cmSystemTools::FindProgram("g++", locations);
  32. std::string gxx = "g++.exe";
  33. if (!tgxx.empty()) {
  34. gxx = tgxx;
  35. }
  36. std::string trc = cmSystemTools::FindProgram("windres", locations);
  37. std::string rc = "windres.exe";
  38. if (!trc.empty()) {
  39. rc = trc;
  40. }
  41. mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
  42. mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
  43. mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str());
  44. this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
  45. }
  46. void cmGlobalMinGWMakefileGenerator::GetDocumentation(
  47. cmDocumentationEntry& entry)
  48. {
  49. entry.Name = cmGlobalMinGWMakefileGenerator::GetActualName();
  50. entry.Brief = "Generates a make file for use with mingw32-make.";
  51. }