cmake/Source/cmGlobalMSYSMakefileGenerator.cxx

60 lines
1.7 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 "cmGlobalMSYSMakefileGenerator.h"
2016-07-09 11:21:54 +02:00
2017-07-20 19:35:53 +02:00
#include "cmsys/FStream.hxx"
2017-04-14 19:02:05 +02:00
#include "cmMakefile.h"
2017-04-14 19:02:05 +02:00
#include "cmState.h"
2022-03-29 21:10:50 +02:00
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
2015-08-17 11:37:30 +02:00
cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
{
this->FindMakeProgramFile = "CMakeMSYSFindMake.cmake";
this->ForceUnixPaths = true;
this->ToolSupportsColor = true;
this->UseLinkScript = false;
2015-08-17 11:37:30 +02:00
cm->GetState()->SetMSYSShell(true);
}
2016-07-09 11:21:54 +02:00
std::string cmGlobalMSYSMakefileGenerator::FindMinGW(
std::string const& makeloc)
{
2020-02-01 23:06:01 +01:00
std::string fstab = cmStrCat(makeloc, "/../etc/fstab");
2014-08-03 19:52:23 +02:00
cmsys::ifstream fin(fstab.c_str());
std::string path;
std::string mount;
std::string mingwBin;
2016-07-09 11:21:54 +02:00
while (fin) {
fin >> path;
fin >> mount;
2016-07-09 11:21:54 +02:00
if (mount == "/mingw") {
2020-02-01 23:06:01 +01:00
mingwBin = cmStrCat(path, "/bin");
}
2016-07-09 11:21:54 +02:00
}
return mingwBin;
}
2016-07-09 11:21:54 +02:00
void cmGlobalMSYSMakefileGenerator::EnableLanguage(
std::vector<std::string> const& l, cmMakefile* mf, bool optional)
{
mf->AddDefinition("MSYS", "1");
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
2016-07-09 11:21:54 +02:00
if (!mf->IsSet("CMAKE_AR") && !this->CMakeInstance->GetIsInTryCompile() &&
!(1 == l.size() && l[0] == "NONE")) {
cmSystemTools::Error(
2019-11-11 23:01:05 +01:00
"CMAKE_AR was not found, please set to archive program. " +
mf->GetSafeDefinition("CMAKE_AR"));
2016-07-09 11:21:54 +02:00
}
}
2023-05-23 16:38:00 +02:00
cmDocumentationEntry cmGlobalMSYSMakefileGenerator::GetDocumentation()
{
2023-05-23 16:38:00 +02:00
return { cmGlobalMSYSMakefileGenerator::GetActualName(),
"Generates MSYS makefiles." };
}