diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-11 12:17:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-15 15:43:50 (GMT) |
commit | 9b5f80a83c07b4c840b190f4f9057f2cf0fa03d4 (patch) | |
tree | 9ff51eeb0c5055bb81ea9eade551bebdacd2bb3b /Source/cmState.cxx | |
parent | 0076b5d8340be81057195e70853d33e8fb66c1db (diff) | |
download | CMake-9b5f80a83c07b4c840b190f4f9057f2cf0fa03d4.zip CMake-9b5f80a83c07b4c840b190f4f9057f2cf0fa03d4.tar.gz CMake-9b5f80a83c07b4c840b190f4f9057f2cf0fa03d4.tar.bz2 |
Move global properties to cmState.
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r-- | Source/cmState.cxx | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 17b6cf2..e46846e 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -191,6 +191,8 @@ void cmState::RemoveCacheEntryProperty(std::string const& key, void cmState::Initialize() { + this->GlobalProperties.clear(); + this->PropertyDefinitions.clear(); this->DefineProperty ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, @@ -384,3 +386,60 @@ void cmState::RemoveUserDefinedCommands() } } } + +void cmState::SetGlobalProperty(const std::string& prop, const char* value) +{ + this->GlobalProperties.SetProperty(prop, value, cmProperty::GLOBAL); +} + +void cmState::AppendGlobalProperty(const std::string& prop, + const char* value, bool asString) +{ + this->GlobalProperties.AppendProperty(prop, value, + cmProperty::GLOBAL, asString); +} + +const char *cmState::GetGlobalProperty(const std::string& prop) +{ + // watch for special properties + std::string output = ""; + if ( prop == "CACHE_VARIABLES" ) + { + std::vector<std::string> cacheKeys = this->GetCacheEntryKeys(); + this->SetGlobalProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str()); + } + else if ( prop == "COMMANDS" ) + { + std::vector<std::string> commands = this->GetCommandNames(); + this->SetGlobalProperty("COMMANDS", cmJoin(commands, ";").c_str()); + } + else if ( prop == "IN_TRY_COMPILE" ) + { + this->SetGlobalProperty("IN_TRY_COMPILE", + this->IsInTryCompile ? "1" : "0"); + } + else if ( prop == "ENABLED_LANGUAGES" ) + { + std::string langs; + langs = cmJoin(this->EnabledLanguages, ";"); + this->SetGlobalProperty("ENABLED_LANGUAGES", langs.c_str()); + } +#define STRING_LIST_ELEMENT(F) ";" #F + if (prop == "CMAKE_C_KNOWN_FEATURES") + { + return FOR_EACH_C_FEATURE(STRING_LIST_ELEMENT) + 1; + } + if (prop == "CMAKE_CXX_KNOWN_FEATURES") + { + return FOR_EACH_CXX_FEATURE(STRING_LIST_ELEMENT) + 1; + } +#undef STRING_LIST_ELEMENT + bool dummy = false; + return this->GlobalProperties.GetPropertyValue(prop, cmProperty::GLOBAL, + dummy); +} + +bool cmState::GetGlobalPropertyAsBool(const std::string& prop) +{ + return cmSystemTools::IsOn(this->GetGlobalProperty(prop)); +} |