diff options
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 15 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 6 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 4 |
4 files changed, 27 insertions, 12 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a9485b5..8ca6ee6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1439,6 +1439,19 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const return false; } +void cmGlobalGenerator::CxxModuleSupportCheck() const +{ + bool const diagnose = !this->DiagnosedCxxModuleSupport && + !this->CMakeInstance->GetIsInTryCompile(); + if (diagnose) { + this->DiagnosedCxxModuleSupport = true; + this->GetCMakeInstance()->IssueMessage( + MessageType::AUTHOR_WARNING, + "C++20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP " + "is experimental. It is meant only for compiler developers to try."); + } +} + void cmGlobalGenerator::ComputeBuildFileGenerators() { for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) { @@ -1597,6 +1610,8 @@ void cmGlobalGenerator::Generate() // it builds by default. this->InitializeProgressMarks(); + this->DiagnosedCxxModuleSupport = false; + this->ProcessEvaluationFiles(); this->CMakeInstance->UpdateProgress("Generating", 0.1f); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 89b2ea8..4ebf9f6 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -157,6 +157,8 @@ public: virtual bool InspectConfigTypeVariables() { return true; } + virtual bool CheckCxxModuleSupport() { return false; } + bool Compute(); virtual void AddExtraIDETargets() {} @@ -621,6 +623,8 @@ protected: virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const; + void CxxModuleSupportCheck() const; + /// @brief Qt AUTOMOC/UIC/RCC target generation /// @return true on success bool QtAutoGen(); @@ -728,6 +732,8 @@ private: std::map<std::string, int> LanguageToLinkerPreference; std::map<std::string, std::string> LanguageToOriginalSharedLibFlags; + mutable bool DiagnosedCxxModuleSupport = false; + // Deferral id generation. size_t NextDeferId = 0; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index e334666..618dfb7 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -591,7 +591,7 @@ void cmGlobalNinjaGenerator::Generate() this->TargetAll = this->NinjaOutputPath("all"); this->CMakeCacheFile = this->NinjaOutputPath("CMakeCache.txt"); this->DisableCleandead = false; - this->DiagnosedCxxModuleSupport = false; + this->DiagnosedCxxModuleNinjaSupport = false; this->PolicyCMP0058 = this->LocalGenerators[0]->GetMakefile()->GetPolicyStatus( @@ -850,18 +850,12 @@ bool cmGlobalNinjaGenerator::CheckLanguages( bool cmGlobalNinjaGenerator::CheckCxxModuleSupport() { - bool const diagnose = !this->DiagnosedCxxModuleSupport && - !this->CMakeInstance->GetIsInTryCompile(); - if (diagnose) { - this->DiagnosedCxxModuleSupport = true; - this->GetCMakeInstance()->IssueMessage( - MessageType::AUTHOR_WARNING, - "C++20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP " - "is experimental. It is meant only for compiler developers to try."); - } + this->CxxModuleSupportCheck(); if (this->NinjaSupportsDyndeps) { return true; } + bool const diagnose = !this->DiagnosedCxxModuleNinjaSupport && + !this->CMakeInstance->GetIsInTryCompile(); if (diagnose) { std::ostringstream e; /* clang-format off */ diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 1628349..6f654f6 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -469,7 +469,7 @@ public: bool IsSingleConfigUtility(cmGeneratorTarget const* target) const; - bool CheckCxxModuleSupport(); + bool CheckCxxModuleSupport() override; protected: void Generate() override; @@ -592,7 +592,7 @@ private: codecvt::Encoding NinjaExpectedEncoding = codecvt::None; - bool DiagnosedCxxModuleSupport = false; + bool DiagnosedCxxModuleNinjaSupport = false; void InitOutputPathPrefix(); |