From 515ca5fcd16f97c9f0a516046dfe22ecfc9676c4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Nov 2023 22:59:28 -0500 Subject: cmCommonTargetGenerator: use modules from object-referenced targets Fortran modules provided by objects added as sources via `$` 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. --- Source/cmCommonTargetGenerator.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index a29dd76..1d670fe 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; } -- cgit v0.12