diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 5ae7d4ca2..6134c6f60 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(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 5ff0186da..0efc7fcf5 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 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 80edbcd22..a8481ad9d 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 ad3cce43c..b1e67f4bf 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 57a418029..43c1b1a6b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -851,9 +851,6 @@ public: const std::vector& 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 e335b3b55..070f6f1ed 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 7602f6324..3e88ecce3 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 f2e8ef5e8..310707dd9 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 PropertyDefinitions; + cmake* CMakeInstance; }; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6711e86db..f1540d437 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 55bf234b2..a03241466 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 8cdf96fe4..6adecee4f 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 e80cc1cc3..38c05c93a 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 GetDebugConfigs(); @@ -373,9 +358,6 @@ protected: int HandleDeleteCacheVariables(const std::string& var); cmPropertyMap Properties; - std::map - PropertyDefinitions; - typedef cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); typedef std::map