cmGlobalMinGWMakefileGenerator.cxx 1.93 KB
Newer Older
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
3
#include "cmGlobalMinGWMakefileGenerator.h"
Brad King's avatar
Brad King committed
4

5
#include "cmDocumentationEntry.h"
6 7
#include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h"
8
#include "cmState.h"
9
#include "cmake.h"
10

11 12
cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
  : cmGlobalUnixMakefileGenerator3(cm)
13
{
14 15
  this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
  this->ForceUnixPaths = true;
16
  this->ToolSupportsColor = true;
17
  this->UseLinkScript = true;
18 19
  cm->GetState()->SetWindowsShell(true);
  cm->GetState()->SetMinGWMake(true);
20 21
}

22 23
void cmGlobalMinGWMakefileGenerator::EnableLanguage(
  std::vector<std::string> const& l, cmMakefile* mf, bool optional)
24
{
25
  this->FindMakeProgram(mf);
26 27
  const std::string& makeProgram =
    mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
28 29 30 31 32 33
  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";
34
  if (!tgcc.empty()) {
35
    gcc = tgcc;
36
  }
37 38
  std::string tgxx = cmSystemTools::FindProgram("g++", locations);
  std::string gxx = "g++.exe";
39
  if (!tgxx.empty()) {
40
    gxx = tgxx;
41
  }
42 43
  std::string trc = cmSystemTools::FindProgram("windres", locations);
  std::string rc = "windres.exe";
44
  if (!trc.empty()) {
45
    rc = trc;
46
  }
47 48 49
  mf->AddDefinition("CMAKE_GENERATOR_CC", gcc);
  mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx);
  mf->AddDefinition("CMAKE_GENERATOR_RC", rc);
50
  this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
51 52
}

53 54
void cmGlobalMinGWMakefileGenerator::GetDocumentation(
  cmDocumentationEntry& entry)
55
{
56
  entry.Name = cmGlobalMinGWMakefileGenerator::GetActualName();
57
  entry.Brief = "Generates a make file for use with mingw32-make.";
58
}