cmGlobalMinGWMakefileGenerator.cxx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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()
  14. {
  15. this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
  16. this->ForceUnixPaths = true;
  17. this->ToolSupportsColor = true;
  18. this->UseLinkScript = true;
  19. this->WindowsShell = true;
  20. this->MinGWMake = true;
  21. }
  22. void cmGlobalMinGWMakefileGenerator
  23. ::EnableLanguage(std::vector<std::string>const& l,
  24. cmMakefile *mf,
  25. bool optional)
  26. {
  27. this->FindMakeProgram(mf);
  28. std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
  29. std::vector<std::string> locations;
  30. locations.push_back(cmSystemTools::GetProgramPath(makeProgram));
  31. locations.push_back("/mingw/bin");
  32. locations.push_back("c:/mingw/bin");
  33. std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
  34. std::string gcc = "gcc.exe";
  35. if(!tgcc.empty())
  36. {
  37. gcc = tgcc;
  38. }
  39. std::string tgxx = cmSystemTools::FindProgram("g++", locations);
  40. std::string gxx = "g++.exe";
  41. if(!tgxx.empty())
  42. {
  43. gxx = tgxx;
  44. }
  45. std::string trc = cmSystemTools::FindProgram("windres", locations);
  46. std::string rc = "windres.exe";
  47. if(!trc.empty())
  48. {
  49. rc = trc;
  50. }
  51. mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
  52. mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
  53. mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str());
  54. this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
  55. }
  56. ///! Create a local generator appropriate to this Global Generator
  57. cmLocalGenerator *
  58. cmGlobalMinGWMakefileGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
  59. {
  60. cmLocalUnixMakefileGenerator3* lg =
  61. new cmLocalUnixMakefileGenerator3(this, parent);
  62. lg->SetIgnoreLibPrefix(true);
  63. return lg;
  64. }
  65. //----------------------------------------------------------------------------
  66. void cmGlobalMinGWMakefileGenerator
  67. ::GetDocumentation(cmDocumentationEntry& entry)
  68. {
  69. entry.Name = cmGlobalMinGWMakefileGenerator::GetActualName();
  70. entry.Brief = "Generates a make file for use with mingw32-make.";
  71. }