summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-09-06 14:55:32 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-09-06 14:55:43 (GMT)
commitd63f0be8fcff7b0ea7a06e6d0fe194d5341d8121 (patch)
tree66afdb763027e88b8bc1bb88590334dbd41b498b
parent275656daea6c918ecbdbe84d874fcd663902c648 (diff)
parent74b1d6caf31d9921b8311012ead4497865e77396 (diff)
downloadCMake-d63f0be8fcff7b0ea7a06e6d0fe194d5341d8121.zip
CMake-d63f0be8fcff7b0ea7a06e6d0fe194d5341d8121.tar.gz
CMake-d63f0be8fcff7b0ea7a06e6d0fe194d5341d8121.tar.bz2
Merge topic 'fortran-object-libraries' into release-3.27
74b1d6caf3 cmComputeLinkInformation: compute link info for module-using targets 6251edaed1 cmGeneratorTarget: support config-independent Fortran source queries Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8772
-rw-r--r--Source/cmComputeLinkInformation.cxx7
-rw-r--r--Source/cmGeneratorTarget.cxx9
-rw-r--r--Source/cmGeneratorTarget.h1
3 files changed, 15 insertions, 2 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index ebbb88f..4804565 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -533,11 +533,14 @@ cmComputeLinkInformation::GetObjectLibrariesLinked() const
bool cmComputeLinkInformation::Compute()
{
- // Skip targets that do not link.
+ // Skip targets that do not link or have link-like information consumers may
+ // need (namely modules).
if (!(this->Target->GetType() == cmStateEnums::EXECUTABLE ||
this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
- this->Target->GetType() == cmStateEnums::STATIC_LIBRARY)) {
+ this->Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->Target->HaveCxx20ModuleSources() ||
+ this->Target->HaveFortranSources())) {
return false;
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 357d0a6..7d1fcf3 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -8873,6 +8873,15 @@ bool cmGeneratorTarget::HaveFortranSources(std::string const& config) const
});
}
+bool cmGeneratorTarget::HaveFortranSources() const
+{
+ auto sources = cmGeneratorTarget::GetAllConfigSources();
+ return std::any_of(sources.begin(), sources.end(),
+ [](AllConfigSource const& sf) -> bool {
+ return sf.Source->GetLanguage() == "Fortran"_s;
+ });
+}
+
bool cmGeneratorTarget::HaveCxx20ModuleSources() const
{
auto const& fs_names = this->Target->GetAllFileSetNames();
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 78945c3..dca69fd 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -1247,6 +1247,7 @@ public:
cmGeneratorTarget const* t2) const;
};
+ bool HaveFortranSources() const;
bool HaveFortranSources(std::string const& config) const;
// C++20 module support queries.