diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index a29dd761a2..1d670fec1a 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -201,6 +201,14 @@ std::vector cmCommonTargetGenerator::GetLinkedTargetDirectories( for (cmGeneratorTarget const* target : cli->GetExternalObjectTargets()) { addLinkedTarget(target); } + if (lang == "Fortran"_s) { + // Fortran modules provided by `$` as sources should be + // collated for use in this target. + for (cmGeneratorTarget const* target : + this->GeneratorTarget->GetSourceObjectLibraries(config)) { + addLinkedTarget(target); + } + } } return dirs; }