1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmGlobalMSYSMakefileGenerator.cxx,v $
6 Date: $Date: 2008-12-01 19:41:47 $
7 Version: $Revision: 1.15 $
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 "cmGlobalMSYSMakefileGenerator.h"
18 #include "cmLocalUnixMakefileGenerator3.h"
19 #include "cmMakefile.h"
22 cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator()
24 this->FindMakeProgramFile
= "CMakeMSYSFindMake.cmake";
25 this->ForceUnixPaths
= true;
26 this->ToolSupportsColor
= true;
27 this->UseLinkScript
= false;
31 cmGlobalMSYSMakefileGenerator::FindMinGW(std::string
const& makeloc
)
33 std::string fstab
= makeloc
;
34 fstab
+= "/../etc/fstab";
35 std::ifstream
fin(fstab
.c_str());
52 void cmGlobalMSYSMakefileGenerator
53 ::EnableLanguage(std::vector
<std::string
>const& l
,
57 this->FindMakeProgram(mf
);
58 std::string makeProgram
= mf
->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
59 std::vector
<std::string
> locations
;
60 std::string makeloc
= cmSystemTools::GetProgramPath(makeProgram
.c_str());
61 locations
.push_back(this->FindMinGW(makeloc
));
62 locations
.push_back(makeloc
);
63 locations
.push_back("/mingw/bin");
64 locations
.push_back("c:/mingw/bin");
65 std::string tgcc
= cmSystemTools::FindProgram("gcc", locations
);
66 std::string gcc
= "gcc.exe";
71 std::string tgxx
= cmSystemTools::FindProgram("g++", locations
);
72 std::string gxx
= "g++.exe";
77 mf
->AddDefinition("MSYS", "1");
78 mf
->AddDefinition("CMAKE_GENERATOR_CC", gcc
.c_str());
79 mf
->AddDefinition("CMAKE_GENERATOR_CXX", gxx
.c_str());
80 this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l
, mf
, optional
);
82 if(!mf
->IsSet("CMAKE_AR") &&
83 !this->CMakeInstance
->GetIsInTryCompile() &&
84 !(1==l
.size() && l
[0]=="NONE"))
87 ("CMAKE_AR was not found, please set to archive program. ",
88 mf
->GetDefinition("CMAKE_AR"));
92 ///! Create a local generator appropriate to this Global Generator
93 cmLocalGenerator
*cmGlobalMSYSMakefileGenerator::CreateLocalGenerator()
95 cmLocalUnixMakefileGenerator3
* lg
= new cmLocalUnixMakefileGenerator3
;
96 lg
->SetWindowsShell(false);
97 lg
->SetMSYSShell(true);
98 lg
->SetGlobalGenerator(this);
99 lg
->SetIgnoreLibPrefix(true);
100 lg
->SetPassMakeflags(false);
105 //----------------------------------------------------------------------------
106 void cmGlobalMSYSMakefileGenerator
107 ::GetDocumentation(cmDocumentationEntry
& entry
) const
109 entry
.Name
= this->GetName();
110 entry
.Brief
= "Generates MSYS makefiles.";
111 entry
.Full
= "The makefiles use /bin/sh as the shell. "
112 "They require msys to be installed on the machine.";