summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-04-19 14:01:10 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2023-05-03 15:08:07 (GMT)
commit375e6fdbbe398921de321216125765ba1917a325 (patch)
tree43d934f18f4d28a82d5264a0d0fb0301bc0bf7d9 /Source/cmMakefileTargetGenerator.cxx
parent24a3e5cda049138ca178216e0d7b02262e4035ed (diff)
downloadCMake-375e6fdbbe398921de321216125765ba1917a325.zip
CMake-375e6fdbbe398921de321216125765ba1917a325.tar.gz
CMake-375e6fdbbe398921de321216125765ba1917a325.tar.bz2
Link step: use linker dependency linker file
Based on work done by @ben.boeckel (!8051) Fixes: #22217
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx29
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index a0a7324..97e3fad 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -150,6 +150,8 @@ void cmMakefileTargetGenerator::GetTargetLinkFlags(
this->LocalGenerator->AppendPositionIndependentLinkerFlags(
flags, this->GeneratorTarget, this->GetConfigName(), linkLanguage);
+ this->LocalGenerator->AppendDependencyInfoLinkerFlags(
+ flags, this->GeneratorTarget, this->GetConfigName(), linkLanguage);
}
void cmMakefileTargetGenerator::CreateRuleFile()
@@ -414,8 +416,10 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
this->GlobalGenerator->SupportsCompilerDependencies() &&
(!this->Makefile->IsDefinitionSet(depsUseCompiler) ||
this->Makefile->IsOn(depsUseCompiler));
+ bool linkerGenerateDeps =
+ this->GeneratorTarget->HasLinkDependencyFile(this->GetConfigName());
- if (compilerGenerateDeps || ccGenerateDeps) {
+ if (compilerGenerateDeps || linkerGenerateDeps || ccGenerateDeps) {
std::string compilerDependFile =
cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.make");
*this->BuildFileStream << "# Include any dependencies generated by the "
@@ -1499,6 +1503,21 @@ bool cmMakefileTargetGenerator::WriteMakeRule(
return symbolic;
}
+void cmMakefileTargetGenerator::WriteTargetLinkDependRules()
+{
+ if (!this->GeneratorTarget->HasLinkDependencyFile(this->GetConfigName())) {
+ return;
+ }
+
+ auto depFile = this->LocalGenerator->GetLinkDependencyFile(
+ this->GeneratorTarget, this->GetConfigName());
+ this->CleanFiles.insert(depFile);
+ this->LocalGenerator->AddImplicitDepends(
+ this->GeneratorTarget, "LINK",
+ this->GeneratorTarget->GetFullPath(this->GetConfigName()), depFile,
+ cmDependencyScannerKind::Compiler);
+}
+
void cmMakefileTargetGenerator::WriteTargetDependRules()
{
// must write the targets depend info file
@@ -2052,8 +2071,14 @@ void cmMakefileTargetGenerator::AppendTargetDepends(
return;
}
- // Loop over all library dependencies.
const std::string& cfg = this->GetConfigName();
+
+ if (this->GeneratorTarget->HasLinkDependencyFile(cfg)) {
+ depends.push_back(
+ cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.ts"));
+ }
+
+ // Loop over all library dependencies.
if (cmComputeLinkInformation* cli =
this->GeneratorTarget->GetLinkInformation(cfg)) {
cm::append(depends, cli->GetDepends());