diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 171d62a07..56a0a4536 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -969,13 +969,7 @@ void cmGlobalGenerator::SetLanguageEnabled(const std::string& l, void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf) { - std::vector::iterator it = - std::lower_bound(this->LanguageEnabled.begin(), - this->LanguageEnabled.end(), l); - if (it == this->LanguageEnabled.end() || *it != l) - { - this->LanguageEnabled.insert(it, l); - } + this->CMakeInstance->GetState()->SetLanguageEnabled(l); // Fill the language-to-extension map with the current variable // settings to make sure it is available for the try_compile() @@ -1086,13 +1080,12 @@ bool cmGlobalGenerator::IgnoreFile(const char* ext) const bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const { - return std::binary_search(this->LanguageEnabled.begin(), - this->LanguageEnabled.end(), l); + return this->CMakeInstance->GetState()->GetLanguageEnabled(l); } void cmGlobalGenerator::ClearEnabledLanguages() { - this->LanguageEnabled.clear(); + return this->CMakeInstance->GetState()->ClearEnabledLanguages(); } void cmGlobalGenerator::Configure() @@ -1966,7 +1959,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, void cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const { - lang = this->LanguageEnabled; + lang = this->CMakeInstance->GetState()->GetEnabledLanguages(); } int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 3e88ecce3..c43262fe5 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -236,3 +236,30 @@ bool cmState::IsPropertyChained(const std::string& name, { return this->PropertyDefinitions[scope].IsPropertyChained(name); } + +void cmState::SetLanguageEnabled(std::string const& l) +{ + std::vector::iterator it = + std::lower_bound(this->EnabledLanguages.begin(), + this->EnabledLanguages.end(), l); + if (it == this->EnabledLanguages.end() || *it != l) + { + this->EnabledLanguages.insert(it, l); + } +} + +bool cmState::GetLanguageEnabled(std::string const& l) const +{ + return std::binary_search(this->EnabledLanguages.begin(), + this->EnabledLanguages.end(), l); +} + +std::vector cmState::GetEnabledLanguages() const +{ + return this->EnabledLanguages; +} + +void cmState::ClearEnabledLanguages() +{ + this->EnabledLanguages.clear(); +} diff --git a/Source/cmState.h b/Source/cmState.h index 310707dd9..b1f143072 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -71,10 +71,14 @@ public: bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope); bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope); + void SetLanguageEnabled(std::string const& l); + bool GetLanguageEnabled(std::string const& l) const; + std::vector GetEnabledLanguages() const; + void ClearEnabledLanguages(); private: std::map PropertyDefinitions; - + std::vector EnabledLanguages; cmake* CMakeInstance; };