diff options
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 2ea18bd..f224ec1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -9190,7 +9190,8 @@ void cmGeneratorTarget::CheckCxxModuleStatus(std::string const& config) const // If the generator doesn't support modules at all, error that we have // sources that require the support. - if (!this->GetGlobalGenerator()->CheckCxxModuleSupport()) { + if (!this->GetGlobalGenerator()->CheckCxxModuleSupport( + cmGlobalGenerator::CxxModuleSupportQuery::Expected)) { this->Makefile->IssueMessage( MessageType::FATAL_ERROR, cmStrCat( @@ -9248,7 +9249,8 @@ bool cmGeneratorTarget::NeedCxxModuleSupport(std::string const& lang, return false; } return this->HaveCxxModuleSupport(config) == Cxx20SupportLevel::Supported && - this->GetGlobalGenerator()->CheckCxxModuleSupport(); + this->GetGlobalGenerator()->CheckCxxModuleSupport( + cmGlobalGenerator::CxxModuleSupportQuery::Inspect); } bool cmGeneratorTarget::NeedDyndep(std::string const& lang, @@ -9292,14 +9294,20 @@ bool cmGeneratorTarget::NeedDyndepForSource(std::string const& lang, return true; } + bool haveRule = false; switch (this->HaveCxxModuleSupport(config)) { case Cxx20SupportLevel::MissingCxx: case Cxx20SupportLevel::NoCxx20: return false; case Cxx20SupportLevel::MissingRule: + break; case Cxx20SupportLevel::Supported: + haveRule = true; break; } + bool haveGeneratorSupport = + this->GetGlobalGenerator()->CheckCxxModuleSupport( + cmGlobalGenerator::CxxModuleSupportQuery::Inspect); auto const sfProp = sf->GetProperty("CXX_SCAN_FOR_MODULES"); if (sfProp.IsSet()) { return sfProp.IsOn(); @@ -9319,8 +9327,9 @@ bool cmGeneratorTarget::NeedDyndepForSource(std::string const& lang, case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::REQUIRED_IF_USED: case cmPolicies::NEW: - // The NEW behavior is to scan the source. - policyAnswer = true; + // The NEW behavior is to scan the source if the compiler supports + // scanning and the generator supports it. + policyAnswer = haveRule && haveGeneratorSupport; break; } return policyAnswer; |