Introduce cmState::Snapshot.
Create snapshots for buildsystem directories during configure time. This class will be extended in follow up commits to snapshot all values in the cmState.
This commit is contained in:
parent
ae6c8a9d68
commit
3a041c5949
@ -54,7 +54,10 @@ public:
|
|||||||
|
|
||||||
// default is not to be building executables
|
// default is not to be building executables
|
||||||
cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
|
cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
|
||||||
: Internal(new Internals)
|
: Internal(new Internals),
|
||||||
|
LocalGenerator(localGenerator),
|
||||||
|
StateSnapshot(localGenerator->GetGlobalGenerator()
|
||||||
|
->GetCMakeInstance()->GetState())
|
||||||
{
|
{
|
||||||
const cmDefinitions& defs = cmDefinitions();
|
const cmDefinitions& defs = cmDefinitions();
|
||||||
const std::set<std::string> globalKeys = defs.LocalKeys();
|
const std::set<std::string> globalKeys = defs.LocalKeys();
|
||||||
@ -63,6 +66,19 @@ cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
|
|||||||
this->Internal->VarUsageStack.push(globalKeys);
|
this->Internal->VarUsageStack.push(globalKeys);
|
||||||
this->Internal->IsSourceFileTryCompile = false;
|
this->Internal->IsSourceFileTryCompile = false;
|
||||||
|
|
||||||
|
if (this->LocalGenerator->GetParent())
|
||||||
|
{
|
||||||
|
cmMakefile* parentMf = this->LocalGenerator->GetParent()->GetMakefile();
|
||||||
|
this->StateSnapshot =
|
||||||
|
this->GetState()->CreateSnapshot(parentMf->StateSnapshot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->StateSnapshot =
|
||||||
|
this->GetState()->CreateSnapshot(this->StateSnapshot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Initialize these first since AddDefaultDefinitions calls AddDefinition
|
// Initialize these first since AddDefaultDefinitions calls AddDefinition
|
||||||
this->WarnUnused = false;
|
this->WarnUnused = false;
|
||||||
this->CheckSystemVars = false;
|
this->CheckSystemVars = false;
|
||||||
|
@ -922,7 +922,7 @@ private:
|
|||||||
cmMakefile& operator=(const cmMakefile& mf);
|
cmMakefile& operator=(const cmMakefile& mf);
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
|
cmState::Snapshot StateSnapshot;
|
||||||
|
|
||||||
bool ReadListFileInternal(const char* filenametoread,
|
bool ReadListFileInternal(const char* filenametoread,
|
||||||
bool noPolicyScope,
|
bool noPolicyScope,
|
||||||
|
@ -22,6 +22,7 @@ cmState::cmState(cmake* cm)
|
|||||||
: CMakeInstance(cm),
|
: CMakeInstance(cm),
|
||||||
IsInTryCompile(false)
|
IsInTryCompile(false)
|
||||||
{
|
{
|
||||||
|
this->CreateSnapshot(Snapshot());
|
||||||
this->Initialize();
|
this->Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,3 +467,17 @@ const char* cmState::GetBinaryDirectory() const
|
|||||||
{
|
{
|
||||||
return this->BinaryDirectory.c_str();
|
return this->BinaryDirectory.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot)
|
||||||
|
{
|
||||||
|
PositionType pos = this->ParentPositions.size();
|
||||||
|
this->ParentPositions.push_back(originSnapshot.Position);
|
||||||
|
return cmState::Snapshot(this, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmState::Snapshot::Snapshot(cmState* state, PositionType position)
|
||||||
|
: State(state),
|
||||||
|
Position(position)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -21,10 +21,24 @@ class cmCommand;
|
|||||||
|
|
||||||
class cmState
|
class cmState
|
||||||
{
|
{
|
||||||
|
typedef std::vector<std::string>::size_type PositionType;
|
||||||
|
friend class Snapshot;
|
||||||
public:
|
public:
|
||||||
cmState(cmake* cm);
|
cmState(cmake* cm);
|
||||||
~cmState();
|
~cmState();
|
||||||
|
|
||||||
|
class Snapshot {
|
||||||
|
public:
|
||||||
|
Snapshot(cmState* state = 0, PositionType position = 0);
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class cmState;
|
||||||
|
cmState* State;
|
||||||
|
cmState::PositionType Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
Snapshot CreateSnapshot(Snapshot originSnapshot);
|
||||||
|
|
||||||
enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
|
enum CacheEntryType{ BOOL=0, PATH, FILEPATH, STRING, INTERNAL,STATIC,
|
||||||
UNINITIALIZED };
|
UNINITIALIZED };
|
||||||
static CacheEntryType StringToCacheEntryType(const char*);
|
static CacheEntryType StringToCacheEntryType(const char*);
|
||||||
@ -106,6 +120,7 @@ private:
|
|||||||
std::map<std::string, cmCommand*> Commands;
|
std::map<std::string, cmCommand*> Commands;
|
||||||
cmPropertyMap GlobalProperties;
|
cmPropertyMap GlobalProperties;
|
||||||
cmake* CMakeInstance;
|
cmake* CMakeInstance;
|
||||||
|
std::vector<PositionType> ParentPositions;
|
||||||
std::string SourceDirectory;
|
std::string SourceDirectory;
|
||||||
std::string BinaryDirectory;
|
std::string BinaryDirectory;
|
||||||
bool IsInTryCompile;
|
bool IsInTryCompile;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user