Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmGlobalMinGWMakefileGenerator.cxx
blob949f2acee19f312a5960234e1c52e4a4e1957ebc
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmGlobalMinGWMakefileGenerator.cxx,v $
5 Language: C++
6 Date: $Date: 2007/10/22 16:48:39 $
7 Version: $Revision: 1.12 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #include "cmGlobalMinGWMakefileGenerator.h"
18 #include "cmLocalUnixMakefileGenerator3.h"
19 #include "cmMakefile.h"
21 cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator()
23 this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
24 this->ForceUnixPaths = true;
25 this->ToolSupportsColor = true;
26 this->UseLinkScript = true;
29 void cmGlobalMinGWMakefileGenerator
30 ::EnableLanguage(std::vector<std::string>const& l,
31 cmMakefile *mf,
32 bool optional)
34 this->FindMakeProgram(mf);
35 std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
36 std::vector<std::string> locations;
37 locations.push_back(cmSystemTools::GetProgramPath(makeProgram.c_str()));
38 locations.push_back("/mingw/bin");
39 locations.push_back("c:/mingw/bin");
40 std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
41 std::string gcc = "gcc.exe";
42 if(tgcc.size())
44 gcc = tgcc;
46 std::string tgxx = cmSystemTools::FindProgram("g++", locations);
47 std::string gxx = "g++.exe";
48 if(tgxx.size())
50 gxx = tgxx;
52 mf->AddDefinition("CMAKE_GENERATOR_CC", gcc.c_str());
53 mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx.c_str());
54 this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
57 ///! Create a local generator appropriate to this Global Generator
58 cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
60 cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
61 lg->SetWindowsShell(true);
62 lg->SetGlobalGenerator(this);
63 lg->SetIgnoreLibPrefix(true);
64 lg->SetPassMakeflags(false);
65 lg->SetUnixCD(true);
66 lg->SetMinGWMake(true);
68 // mingw32-make has trouble running code like
70 // @echo message with spaces
72 // If quotes are added
74 // @echo "message with spaces"
76 // it runs but the quotes are displayed. Instead just use cmake to
77 // echo.
78 lg->SetNativeEchoCommand("@$(CMAKE_COMMAND) -E echo ", false);
79 return lg;
82 //----------------------------------------------------------------------------
83 void cmGlobalMinGWMakefileGenerator
84 ::GetDocumentation(cmDocumentationEntry& entry) const
86 entry.Name = this->GetName();
87 entry.Brief = "Generates a make file for use with mingw32-make.";
88 entry.Full = "The makefiles generated use cmd.exe as the shell. "
89 "They do not require msys or a unix shell.";