diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-11-18 03:59:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-11-23 19:26:31 (GMT) |
commit | 7cd0adab1b0149fe227c4eda3bd085e2d1f4dd52 (patch) | |
tree | 3ce271d10ddb07a85f23874cd1d95f0dca2ffd03 /Source/cmCommonTargetGenerator.cxx | |
parent | 1175f1c874a7cd34d643902bc428df92bce3471a (diff) | |
download | CMake-7cd0adab1b0149fe227c4eda3bd085e2d1f4dd52.zip CMake-7cd0adab1b0149fe227c4eda3bd085e2d1f4dd52.tar.gz CMake-7cd0adab1b0149fe227c4eda3bd085e2d1f4dd52.tar.bz2 |
cmCommonTargetGenerator: use modules from linked object-referenced targets
Fortran modules provided by objects added as linked items 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.cxx | 13 |
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); |