1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #include "cmGlobalMinGWMakefileGenerator.h"
13 #include "cmLocalUnixMakefileGenerator3.h"
14 #include "cmMakefile.h"
16 cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator()
18 this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
19 this->ForceUnixPaths = true;
20 this->ToolSupportsColor = true;
21 this->UseLinkScript = true;
24 void cmGlobalMinGWMakefileGenerator
25 ::EnableLanguage(std::vector<std::string>const& l,
29 this->FindMakeProgram(mf);
30 std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
31 std::vector<std::string> locations;
32 locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str()));
33 locations.push_back("/mingw/bin");
34 locations.push_back("c:/mingw/bin");
35 std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
36 std::string gcc = "gcc.exe";
41 std::string tgxx = cmSystemTools::FindProgram("g++", locations);
42 std::string gxx = "g++.exe";
47 std::string trc = cmSystemTools::FindProgram("windres", locations);
48 std::string rc = "windres.exe";
53 mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
54 mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
55 mf->AddDefinition("CMAKE_GENERATOR_RC", rc.c_str());
56 this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
59 ///! Create a local generator appropriate to this Global Generator
60 cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
62 cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
63 lg->SetWindowsShell(true);
64 lg->SetGlobalGenerator(this);
65 lg->SetIgnoreLibPrefix(true);
66 lg->SetPassMakeflags(false);
68 lg->SetMinGWMake(true);
72 //----------------------------------------------------------------------------
73 void cmGlobalMinGWMakefileGenerator
74 ::GetDocumentation(cmDocumentationEntry& entry) const
76 entry.Name = this->GetName();
77 entry.Brief = "Generates a make file for use with mingw32-make.";
78 entry.Full = "The makefiles generated use cmd.exe as the shell. "
79 "They do not require msys or a unix shell.";