mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 03:59:58 +00:00
e91bfe440c
This changes `cmMakefile::AddDefinition` to take a `cm::string_view` as value argument instead of a `const char *`. Benefits are: - `std::string` can be passed to `cmMakefile::AddDefinition` directly without the `c_str()` plus string length recomputation fallback. - Lengths of literals passed to `cmMakefile::AddDefinition` can be computed at compile time. In various sources uses of `cmMakefile::AddDefinition` are adapted to avoid `std::string::c_str` calls and the `std::string` is passed directly. Uses of `cmMakefile::AddDefinition`, where a `nullptr` `const char*` might be passed to `cmMakefile::AddDefinition` are extended with `nullptr` checks.
59 lines
1.9 KiB
C++
59 lines
1.9 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
#include "cmGlobalMinGWMakefileGenerator.h"
|
|
|
|
#include "cmDocumentationEntry.h"
|
|
#include "cmLocalUnixMakefileGenerator3.h"
|
|
#include "cmMakefile.h"
|
|
#include "cmState.h"
|
|
#include "cmake.h"
|
|
|
|
cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
|
|
: cmGlobalUnixMakefileGenerator3(cm)
|
|
{
|
|
this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
|
|
this->ForceUnixPaths = true;
|
|
this->ToolSupportsColor = true;
|
|
this->UseLinkScript = true;
|
|
cm->GetState()->SetWindowsShell(true);
|
|
cm->GetState()->SetMinGWMake(true);
|
|
}
|
|
|
|
void cmGlobalMinGWMakefileGenerator::EnableLanguage(
|
|
std::vector<std::string> const& l, cmMakefile* mf, bool optional)
|
|
{
|
|
this->FindMakeProgram(mf);
|
|
const std::string& makeProgram =
|
|
mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
|
|
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";
|
|
if (!tgcc.empty()) {
|
|
gcc = tgcc;
|
|
}
|
|
std::string tgxx = cmSystemTools::FindProgram("g++", locations);
|
|
std::string gxx = "g++.exe";
|
|
if (!tgxx.empty()) {
|
|
gxx = tgxx;
|
|
}
|
|
std::string trc = cmSystemTools::FindProgram("windres", locations);
|
|
std::string rc = "windres.exe";
|
|
if (!trc.empty()) {
|
|
rc = trc;
|
|
}
|
|
mf->AddDefinition("CMAKE_GENERATOR_CC", gcc);
|
|
mf->AddDefinition("CMAKE_GENERATOR_CXX", gxx);
|
|
mf->AddDefinition("CMAKE_GENERATOR_RC", rc);
|
|
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
|
|
}
|
|
|
|
void cmGlobalMinGWMakefileGenerator::GetDocumentation(
|
|
cmDocumentationEntry& entry)
|
|
{
|
|
entry.Name = cmGlobalMinGWMakefileGenerator::GetActualName();
|
|
entry.Brief = "Generates a make file for use with mingw32-make.";
|
|
}
|