From d19648a9286d0943858ea0c5dc5e13d3b735b129 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 31 Jan 2023 22:19:47 -0500 Subject: cmGeneratorTarget: add a method to query if Fortran sources exist --- Source/cmGeneratorTarget.cxx | 9 +++++++++ Source/cmGeneratorTarget.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 30aa99b..5e352b2 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -8860,6 +8860,15 @@ std::string cmGeneratorTarget::GenerateHeaderSetVerificationFile( return filename; } +bool cmGeneratorTarget::HaveFortranSources(std::string const& config) const +{ + auto sources = cmGeneratorTarget::GetSourceFiles(config); + return std::any_of(sources.begin(), sources.end(), + [](BT const& sf) -> bool { + return sf.Value->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 dd10c64..afd9da4 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -1225,6 +1225,8 @@ public: cmGeneratorTarget const* t2) const; }; + bool HaveFortranSources(std::string const& config) const; + // C++20 module support queries. /** -- cgit v0.12