mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 12:09:48 +00:00
Move property definition to cmState.
This commit is contained in:
parent
62c5e6f1a1
commit
b159bff732
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user