From 9e61fc3d6d71ebb1935fde39b011bf8167bd40d1 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 23 Nov 2022 15:22:31 -0500 Subject: cmGeneratorTarget: factor out dyndep support detection --- Source/cmGeneratorTarget.cxx | 16 ++++++++++++++++ Source/cmGeneratorTarget.h | 4 ++++ Source/cmNinjaTargetGenerator.cxx | 21 ++------------------- Source/cmNinjaTargetGenerator.h | 3 --- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index fae6d54..bf0aa8e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -8869,3 +8869,19 @@ void cmGeneratorTarget::CheckCxxModuleStatus(std::string const& config) const } } } + +bool cmGeneratorTarget::NeedCxxModuleSupport(std::string const& lang, + std::string const& config) const +{ + if (lang != "CXX"_s) { + return false; + } + return this->HaveCxxModuleSupport(config) == Cxx20SupportLevel::Supported && + this->GetGlobalGenerator()->CheckCxxModuleSupport(); +} + +bool cmGeneratorTarget::NeedDyndep(std::string const& lang, + std::string const& config) const +{ + return lang == "Fortran"_s || this->NeedCxxModuleSupport(lang, config); +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 25e6a81..858be36 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -1229,4 +1229,8 @@ public: // Check C++ module status for the target. void CheckCxxModuleStatus(std::string const& config) const; + + bool NeedCxxModuleSupport(std::string const& lang, + std::string const& config) const; + bool NeedDyndep(std::string const& lang, std::string const& config) const; }; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d39e155..68757b8 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -157,23 +157,6 @@ std::string cmNinjaTargetGenerator::LanguageDyndepRule( '_', config); } -bool cmNinjaTargetGenerator::NeedCxxModuleSupport( - std::string const& lang, std::string const& config) const -{ - if (lang != "CXX"_s) { - return false; - } - return this->GetGeneratorTarget()->HaveCxxModuleSupport(config) == - cmGeneratorTarget::Cxx20SupportLevel::Supported && - this->GetGlobalGenerator()->CheckCxxModuleSupport(); -} - -bool cmNinjaTargetGenerator::NeedDyndep(std::string const& lang, - std::string const& config) const -{ - return lang == "Fortran" || this->NeedCxxModuleSupport(lang, config); -} - void cmNinjaTargetGenerator::BuildFileSetInfoCache(std::string const& config) { auto& per_config = this->Configs[config]; @@ -236,7 +219,7 @@ bool cmNinjaTargetGenerator::NeedDyndepForSource(std::string const& lang, std::string const& config, cmSourceFile const* sf) { - bool const needDyndep = this->NeedDyndep(lang, config); + bool const needDyndep = this->GetGeneratorTarget()->NeedDyndep(lang, config); if (!needDyndep) { return false; } @@ -699,7 +682,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, const std::string& config) { // For some cases we scan to dynamically discover dependencies. - bool const needDyndep = this->NeedDyndep(lang, config); + bool const needDyndep = this->GetGeneratorTarget()->NeedDyndep(lang, config); if (needDyndep) { this->WriteCompileRule(lang, config, WithScanning::Yes); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index d09f04b..04d6bd7 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -82,13 +82,10 @@ protected: const std::string& config) const; std::string LanguageDyndepRule(std::string const& lang, const std::string& config) const; - bool NeedDyndep(std::string const& lang, std::string const& config) const; bool NeedDyndepForSource(std::string const& lang, std::string const& config, cmSourceFile const* sf); bool NeedExplicitPreprocessing(std::string const& lang) const; bool CompileWithDefines(std::string const& lang) const; - bool NeedCxxModuleSupport(std::string const& lang, - std::string const& config) const; std::string OrderDependsTargetForTarget(const std::string& config); -- cgit v0.12