cmGlobalMinGWMakefileGenerator.cxx 1.9 KB

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