summaryrefslogtreecommitdiffstats
path: root/Source/cmCommonTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmCommonTargetGenerator.cxx')
-rw-r--r--Source/cmCommonTargetGenerator.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 0896216..90f0d55 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -211,7 +211,18 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories(
}
};
for (auto const& item : cli->GetItems()) {
- addLinkedTarget(item.Target, Forwarding::No);
+ if (item.Target) {
+ addLinkedTarget(item.Target, Forwarding::No);
+ } else if (item.ObjectSource && lang == "Fortran"_s
+ /* Object source files do not have a language associated with
+ them. */
+ /* && item.ObjectSource->GetLanguage() == "Fortran"_s*/) {
+ // Fortran modules provided by `$<TARGET_OBJECTS>` as linked items
+ // should be collated for use in this target.
+ addLinkedTarget(this->LocalCommonGenerator->FindGeneratorTargetToUse(
+ item.ObjectSource->GetObjectLibrary()),
+ Forwarding::Yes);
+ }
}
for (cmGeneratorTarget const* target : cli->GetExternalObjectTargets()) {
addLinkedTarget(target, Forwarding::No);