diff options
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 15 | ||||
-rw-r--r-- | Source/cmState.cxx | 27 | ||||
-rw-r--r-- | Source/cmState.h | 6 |
3 files changed, 36 insertions, 12 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 171d62a..56a0a45 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<std::string>::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<std::string>& 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 3e88ecc..c43262f 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<std::string>::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<std::string> cmState::GetEnabledLanguages() const +{ + return this->EnabledLanguages; +} + +void cmState::ClearEnabledLanguages() +{ + this->EnabledLanguages.clear(); +} diff --git a/Source/cmState.h b/Source/cmState.h index 310707d..b1f1430 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<std::string> GetEnabledLanguages() const; + void ClearEnabledLanguages(); private: std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions; - + std::vector<std::string> EnabledLanguages; cmake* CMakeInstance; }; |