summaryrefslogtreecommitdiffstats
path: root/Source/cmCommonTargetGenerator.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-11-18 03:59:28 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-11-21 14:42:58 (GMT)
commit515ca5fcd16f97c9f0a516046dfe22ecfc9676c4 (patch)
tree535e88b6f997b8d1e146a9cd9ae752c296d8e9af /Source/cmCommonTargetGenerator.cxx
parentd8182105a1d62307aa5f5aa8388e074ecacf0773 (diff)
downloadCMake-515ca5fcd16f97c9f0a516046dfe22ecfc9676c4.zip
CMake-515ca5fcd16f97c9f0a516046dfe22ecfc9676c4.tar.gz
CMake-515ca5fcd16f97c9f0a516046dfe22ecfc9676c4.tar.bz2
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.
Diffstat (limited to 'Source/cmCommonTargetGenerator.cxx')
-rw-r--r--Source/cmCommonTargetGenerator.cxx8
1 files changed, 8 insertions, 0 deletions
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<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;
}