diff options
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 9 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 12 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.h | 2 |
5 files changed, 22 insertions, 8 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index a9225dc..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, @@ -9304,7 +9306,8 @@ bool cmGeneratorTarget::NeedDyndepForSource(std::string const& lang, break; } bool haveGeneratorSupport = - this->GetGlobalGenerator()->CheckCxxModuleSupport(); + this->GetGlobalGenerator()->CheckCxxModuleSupport( + cmGlobalGenerator::CxxModuleSupportQuery::Inspect); auto const sfProp = sf->GetProperty("CXX_SCAN_FOR_MODULES"); if (sfProp.IsSet()) { return sfProp.IsOn(); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 6d29dc1..aa54f69 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -156,7 +156,17 @@ public: virtual bool InspectConfigTypeVariables() { return true; } - virtual bool CheckCxxModuleSupport() { return false; } + enum class CxxModuleSupportQuery + { + // Support is expected at the call site. + Expected, + // The call site is querying for support and handles problems by itself. + Inspect, + }; + virtual bool CheckCxxModuleSupport(CxxModuleSupportQuery /*query*/) + { + return false; + } virtual bool IsGNUMakeJobServerAware() const { return false; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 7368a6a..d691d88 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -882,13 +882,14 @@ bool cmGlobalNinjaGenerator::CheckLanguages( return true; } -bool cmGlobalNinjaGenerator::CheckCxxModuleSupport() +bool cmGlobalNinjaGenerator::CheckCxxModuleSupport(CxxModuleSupportQuery query) { if (this->NinjaSupportsDyndepsCxx) { return true; } bool const diagnose = !this->DiagnosedCxxModuleNinjaSupport && - !this->CMakeInstance->GetIsInTryCompile(); + !this->CMakeInstance->GetIsInTryCompile() && + query == CxxModuleSupportQuery::Expected; if (diagnose) { std::ostringstream e; /* clang-format off */ diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 56a922c..c5d6901 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -475,7 +475,7 @@ public: bool IsSingleConfigUtility(cmGeneratorTarget const* target) const; - bool CheckCxxModuleSupport() override; + bool CheckCxxModuleSupport(CxxModuleSupportQuery query) override; protected: void Generate() override; diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index 8f0345f..49643ea 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -48,7 +48,7 @@ public: const char* GetAndroidApplicationTypeRevision() const override; - bool CheckCxxModuleSupport() override + bool CheckCxxModuleSupport(CxxModuleSupportQuery /*query*/) override { return this->SupportsCxxModuleDyndep(); } |