diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-04 21:33:26 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-04-13 18:13:13 (GMT) |
commit | b159bff732d4e34a683edd1740604428049d1819 (patch) | |
tree | ef8513a3fa37802bc27c11543209da7e8cd9f2da | |
parent | 62c5e6f1a19df0043a0e9aaba6cf7247f76a5cc3 (diff) | |
download | CMake-b159bff732d4e34a683edd1740604428049d1819.zip CMake-b159bff732d4e34a683edd1740604428049d1819.tar.gz CMake-b159bff732d4e34a683edd1740604428049d1819.tar.bz2 |
Move property definition to cmState.
-rw-r--r-- | Source/cmCPluginAPI.cxx | 2 | ||||
-rw-r--r-- | Source/cmDefinePropertyCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmGetPropertyCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 15 | ||||
-rw-r--r-- | Source/cmMakefile.h | 3 | ||||
-rw-r--r-- | Source/cmPropertyMap.cxx | 4 | ||||
-rw-r--r-- | Source/cmState.cxx | 58 | ||||
-rw-r--r-- | Source/cmState.h | 19 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 14 | ||||
-rw-r--r-- | Source/cmTarget.h | 3 | ||||
-rw-r--r-- | Source/cmake.cxx | 39 | ||||
-rw-r--r-- | Source/cmake.h | 18 |
12 files changed, 87 insertions, 97 deletions
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 5ae7d4c..6134c6f 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -867,7 +867,7 @@ void CCONV DefineSourceFileProperty (void *arg, const char *name, int chained) { cmMakefile *mf = static_cast<cmMakefile *>(arg); - mf->GetCMakeInstance()->DefineProperty(name,cmProperty::SOURCE_FILE, + mf->GetState()->DefineProperty(name,cmProperty::SOURCE_FILE, briefDocs, longDocs, chained != 0); } diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx index 5ff0186..0efc7fc 100644 --- a/Source/cmDefinePropertyCommand.cxx +++ b/Source/cmDefinePropertyCommand.cxx @@ -11,6 +11,7 @@ ============================================================================*/ #include "cmDefinePropertyCommand.h" #include "cmake.h" +#include "cmState.h" bool cmDefinePropertyCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) @@ -127,7 +128,7 @@ bool cmDefinePropertyCommand } // Actually define the property. - this->Makefile->GetCMakeInstance()->DefineProperty + this->Makefile->GetState()->DefineProperty (this->PropertyName, scope, this->BriefDocs.c_str(), this->FullDocs.c_str(), inherited); diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 80edbcd..a8481ad 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -143,7 +143,7 @@ bool cmGetPropertyCommand // Lookup brief documentation. std::string output; if(cmPropertyDefinition* def = - this->Makefile->GetCMakeInstance()-> + this->Makefile->GetState()-> GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetShortDescription(); @@ -159,7 +159,7 @@ bool cmGetPropertyCommand // Lookup full documentation. std::string output; if(cmPropertyDefinition* def = - this->Makefile->GetCMakeInstance()-> + this->Makefile->GetState()-> GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetFullDescription(); @@ -173,7 +173,7 @@ bool cmGetPropertyCommand else if(this->InfoType == OutDefined) { // Lookup if the property is defined - if(this->Makefile->GetCMakeInstance()-> + if(this->Makefile->GetState()-> GetPropertyDefinition(this->PropertyName, scope)) { this->Makefile->AddDefinition(this->Variable, "1"); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ad3cce4..b1e67f4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4476,21 +4476,6 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef) } } - -// define properties -void cmMakefile::DefineProperties(cmake *cm) -{ - cm->DefineProperty - ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, - "", "", true); - cm->DefineProperty - ("RULE_LAUNCH_LINK", cmProperty::DIRECTORY, - "", "", true); - cm->DefineProperty - ("RULE_LAUNCH_CUSTOM", cmProperty::DIRECTORY, - "", "", true); -} - //---------------------------------------------------------------------------- cmTarget* cmMakefile::AddImportedTarget(const std::string& name, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 57a4180..43c1b1a 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -851,9 +851,6 @@ public: const std::vector<cmTestGenerator*>& GetTestGenerators() const { return this->TestGenerators; } - // Define the properties - static void DefineProperties(cmake *cm); - // push and pop variable scopes void PushScope(); void PopScope(); diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index e335b3b..070f6f1 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -12,6 +12,7 @@ #include "cmPropertyMap.h" #include "cmSystemTools.h" #include "cmake.h" +#include "cmState.h" cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name) { @@ -73,7 +74,8 @@ const char *cmPropertyMap // should we chain up? if (this->CMakeInstance) { - chain = this->CMakeInstance->IsPropertyChained(name,scope); + chain = this->CMakeInstance->GetState()-> + IsPropertyChained(name,scope); } return 0; } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 7602f63..3e88ecc 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -178,3 +178,61 @@ void cmState::RemoveCacheEntryProperty(std::string const& key, this->CMakeInstance->GetCacheManager() ->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0); } + +void cmState::Initialize() +{ + this->PropertyDefinitions.clear(); + this->DefineProperty + ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, + "", "", true); + this->DefineProperty + ("RULE_LAUNCH_LINK", cmProperty::DIRECTORY, + "", "", true); + this->DefineProperty + ("RULE_LAUNCH_CUSTOM", cmProperty::DIRECTORY, + "", "", true); + + this->DefineProperty + ("RULE_LAUNCH_COMPILE", cmProperty::TARGET, + "", "", true); + this->DefineProperty + ("RULE_LAUNCH_LINK", cmProperty::TARGET, + "", "", true); + this->DefineProperty + ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET, + "", "", true); +} + +void cmState::DefineProperty(const std::string& name, + cmProperty::ScopeType scope, + const char *ShortDescription, + const char *FullDescription, + bool chained) +{ + this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription, + FullDescription, + chained); +} + +cmPropertyDefinition *cmState +::GetPropertyDefinition(const std::string& name, + cmProperty::ScopeType scope) +{ + if (this->IsPropertyDefined(name,scope)) + { + return &(this->PropertyDefinitions[scope][name]); + } + return 0; +} + +bool cmState::IsPropertyDefined(const std::string& name, + cmProperty::ScopeType scope) +{ + return this->PropertyDefinitions[scope].IsPropertyDefined(name); +} + +bool cmState::IsPropertyChained(const std::string& name, + cmProperty::ScopeType scope) +{ + return this->PropertyDefinitions[scope].IsPropertyChained(name); +} diff --git a/Source/cmState.h b/Source/cmState.h index f2e8ef5..310707d 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -13,6 +13,7 @@ #define cmState_h #include "cmStandardIncludes.h" +#include "cmPropertyDefinitionMap.h" class cmake; @@ -55,7 +56,25 @@ public: void RemoveCacheEntryProperty(std::string const& key, std::string const& propertyName); + void Initialize(); + // Define a property + void DefineProperty(const std::string& name, cmProperty::ScopeType scope, + const char *ShortDescription, + const char *FullDescription, + bool chain = false); + + // get property definition + cmPropertyDefinition *GetPropertyDefinition + (const std::string& name, cmProperty::ScopeType scope); + + // Is a property defined? + bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope); + bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope); + + private: + std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions; + cmake* CMakeInstance; }; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6711e86..f1540d4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -264,20 +264,6 @@ cmTarget::cmTarget() this->LinkImplementationLanguageIsContextDependent = true; } -//---------------------------------------------------------------------------- -void cmTarget::DefineProperties(cmake *cm) -{ - cm->DefineProperty - ("RULE_LAUNCH_COMPILE", cmProperty::TARGET, - "", "", true); - cm->DefineProperty - ("RULE_LAUNCH_LINK", cmProperty::TARGET, - "", "", true); - cm->DefineProperty - ("RULE_LAUNCH_CUSTOM", cmProperty::TARGET, - "", "", true); -} - void cmTarget::SetType(TargetType type, const std::string& name) { this->Name = name; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 55bf234..a032414 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -489,9 +489,6 @@ public: const char** imp, std::string& suffix) const; - // Define the properties - static void DefineProperties(cmake *cm); - /** Get the macro to define when building sources in this target. If no macro should be defined null is returned. */ const char* GetExportMacro() const; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8cdf96f..6adecee 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -191,11 +191,8 @@ cmake::~cmake() void cmake::InitializeProperties() { this->Properties.clear(); - this->PropertyDefinitions.clear(); - // initialize properties - cmTarget::DefineProperties(this); - cmMakefile::DefineProperties(this); + this->State->Initialize(); } void cmake::CleanupCommandsAndMacros() @@ -2298,40 +2295,6 @@ void cmake::GenerateGraphViz(const char* fileName) const #endif } -void cmake::DefineProperty(const std::string& name, - cmProperty::ScopeType scope, - const char *ShortDescription, - const char *FullDescription, - bool chained) -{ - this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription, - FullDescription, - chained); -} - -cmPropertyDefinition *cmake -::GetPropertyDefinition(const std::string& name, - cmProperty::ScopeType scope) -{ - if (this->IsPropertyDefined(name,scope)) - { - return &(this->PropertyDefinitions[scope][name]); - } - return 0; -} - -bool cmake::IsPropertyDefined(const std::string& name, - cmProperty::ScopeType scope) -{ - return this->PropertyDefinitions[scope].IsPropertyDefined(name); -} - -bool cmake::IsPropertyChained(const std::string& name, - cmProperty::ScopeType scope) -{ - return this->PropertyDefinitions[scope].IsPropertyChained(name); -} - void cmake::SetProperty(const std::string& prop, const char* value) { this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); diff --git a/Source/cmake.h b/Source/cmake.h index e80cc1c..38c05c9 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -15,7 +15,6 @@ #include "cmListFileCache.h" #include "cmSystemTools.h" -#include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" #include "cmInstalledFile.h" #include "cmCacheManager.h" @@ -323,20 +322,6 @@ class cmake void MarkCliAsUsed(const std::string& variable); - // Define a property - void DefineProperty(const std::string& name, cmProperty::ScopeType scope, - const char *ShortDescription, - const char *FullDescription, - bool chain = false); - - // get property definition - cmPropertyDefinition *GetPropertyDefinition - (const std::string& name, cmProperty::ScopeType scope); - - // Is a property defined? - bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope); - bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope); - /** Get the list of configurations (in upper case) considered to be debugging configurations.*/ std::vector<std::string> GetDebugConfigs(); @@ -373,9 +358,6 @@ protected: int HandleDeleteCacheVariables(const std::string& var); cmPropertyMap Properties; - std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> - PropertyDefinitions; - typedef cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); typedef std::map<std::string, |