1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-13 17:47:49 +08:00

Refactoring: Abstract Makefile line continuation format

This commit is contained in:
Marc Chevrier
2020-11-23 12:14:17 +01:00
parent b6068ce407
commit afd0f6785d
4 changed files with 6 additions and 9 deletions

View File

@@ -44,6 +44,7 @@ cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm)
#endif
this->IncludeDirective = "include";
this->LineContinueDirective = "\\\n";
this->DefineWindowsNULL = false;
this->PassMakeflags = false;
this->UnixCD = true;

View File

@@ -170,6 +170,7 @@ public:
void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override;
std::string IncludeDirective;
std::string LineContinueDirective;
bool DefineWindowsNULL;
bool PassMakeflags;
bool UnixCD;

View File

@@ -25,6 +25,7 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
#endif
cm->GetState()->SetWatcomWMake(true);
this->IncludeDirective = "!include";
this->LineContinueDirective = "&\n";
this->DefineWindowsNULL = true;
this->UnixCD = false;
this->MakeSilentFlag = "-h";
@@ -37,7 +38,6 @@ void cmGlobalWatcomWMakeGenerator::EnableLanguage(
mf->AddDefinition("WATCOM", "1");
mf->AddDefinition("CMAKE_QUOTE_INCLUDE_PATHS", "1");
mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1");
mf->AddDefinition("CMAKE_MAKE_LINE_CONTINUE", "&");
mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC");
mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386");

View File

@@ -1544,12 +1544,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
<< this->GeneratorTarget->GetName() << "\n"
<< variableName << " =";
std::string object;
std::string lineContinue;
if (cmProp p = this->Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE")) {
lineContinue = *p;
} else {
lineContinue = "\\";
}
const auto& lineContinue = this->GlobalGenerator->LineContinueDirective;
cmProp pchExtension = this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
@@ -1557,7 +1552,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
if (cmSystemTools::StringEndsWith(obj, cmToCStr(pchExtension))) {
continue;
}
*this->BuildFileStream << " " << lineContinue << "\n";
*this->BuildFileStream << " " << lineContinue;
*this->BuildFileStream
<< cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(
obj, useWatcomQuote);
@@ -1580,7 +1575,7 @@ void cmMakefileTargetGenerator::WriteObjectsVariable(
for (std::string const& obj : this->ExternalObjects) {
object =
this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, obj);
*this->BuildFileStream << " " << lineContinue << "\n";
*this->BuildFileStream << " " << lineContinue;
*this->BuildFileStream
<< cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(
obj, useWatcomQuote);