1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +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 #endif
this->IncludeDirective = "include"; this->IncludeDirective = "include";
this->LineContinueDirective = "\\\n";
this->DefineWindowsNULL = false; this->DefineWindowsNULL = false;
this->PassMakeflags = false; this->PassMakeflags = false;
this->UnixCD = true; this->UnixCD = true;

View File

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

View File

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

View File

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