cmake/Source/cmGlobalMinGWMakefileGenerator.cxx

59 lines
1.9 KiB
C++
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalMinGWMakefileGenerator.h"
2016-07-09 11:21:54 +02:00
2017-04-14 19:02:05 +02:00
#include "cmDocumentationEntry.h"
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
2017-04-14 19:02:05 +02:00
#include "cmState.h"
2019-11-11 23:01:05 +01:00
#include "cmake.h"
2015-08-17 11:37:30 +02:00
cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
{
this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
this->ForceUnixPaths = true;
this->ToolSupportsColor = true;
this->UseLinkScript = true;
2015-08-17 11:37:30 +02:00
cm->GetState()->SetWindowsShell(true);
cm->GetState()->SetMinGWMake(true);
}
2016-07-09 11:21:54 +02:00
void cmGlobalMinGWMakefileGenerator::EnableLanguage(
std::vector<std::string> const& l, cmMakefile* mf, bool optional)
2013-03-16 19:13:01 +02:00
{
2015-08-17 11:37:30 +02:00
this->FindMakeProgram(mf);
2019-11-11 23:01:05 +01:00
const std::string& makeProgram =
mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
2015-08-17 11:37:30 +02:00
std::vector<std::string> locations;
locations.push_back(cmSystemTools::GetProgramPath(makeProgram));
locations.push_back("/mingw/bin");
locations.push_back("c:/mingw/bin");
std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
std::string gcc = "gcc.exe";
2016-07-09 11:21:54 +02:00
if (!tgcc.empty()) {
2015-08-17 11:37:30 +02:00
gcc = tgcc;
2016-07-09 11:21:54 +02:00
}
2015-08-17 11:37:30 +02:00
std::string tgxx = cmSystemTools::FindProgram("g++", locations);
std::string gxx = "g++.exe";
2016-07-09 11:21:54 +02:00
if (!tgxx.empty()) {
2015-08-17 11:37:30 +02:00
gxx = tgxx;
2016-07-09 11:21:54 +02:00
}
2015-08-17 11:37:30 +02:00
std::string trc = cmSystemTools::FindProgram("windres", locations);
std::string rc = "windres.exe";
2016-07-09 11:21:54 +02:00
if (!trc.empty()) {
2015-08-17 11:37:30 +02:00
rc = trc;
2016-07-09 11:21:54 +02:00
}
2020-02-01 23:06:01 +01:00
mf->AddDefinition("CMAKE_GENERATOR_CC", gcc);
mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx);
mf->AddDefinition("CMAKE_GENERATOR_RC", rc);
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
}
2016-07-09 11:21:54 +02:00
void cmGlobalMinGWMakefileGenerator::GetDocumentation(
cmDocumentationEntry& entry)
{
2013-03-16 19:13:01 +02:00
entry.Name = cmGlobalMinGWMakefileGenerator::GetActualName();
entry.Brief = "Generates a make file for use with mingw32-make.";
}