cmCommonTargetGenerator: use modules from object-referenced targets

Fortran modules provided by objects added as sources via
`$<TARGET_OBJECTS>` should also be considered as "linked targets" for
collation purposes. As C++ modules have their own visibility rules
through their `FILE_SET` feature, do not expose these for C++ module
collation.
This commit is contained in:
Ben Boeckel
2023-11-21 09:42:58 -05:00
parent d8182105a1
commit 515ca5fcd1
+8
View File
@@ -201,6 +201,14 @@ std::vector<std::string> cmCommonTargetGenerator::GetLinkedTargetDirectories(
for (cmGeneratorTarget const* target : cli->GetExternalObjectTargets()) {
addLinkedTarget(target);
}
if (lang == "Fortran"_s) {
// Fortran modules provided by `$<TARGET_OBJECTS>` as sources should be
// collated for use in this target.
for (cmGeneratorTarget const* target :
this->GeneratorTarget->GetSourceObjectLibraries(config)) {
addLinkedTarget(target);
}
}
}
return dirs;
}