cmState: Host buildsystem properties for directories.
This commit is contained in:
parent
8f0a5d84e3
commit
6ed9c7e024
|
@ -273,68 +273,36 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Range, typename T>
|
|
||||||
typename Range::const_iterator find_backwards(Range const& range, T t)
|
|
||||||
{
|
|
||||||
typename Range::const_reverse_iterator rend =
|
|
||||||
std::find(range.rbegin(), range.rend(), t);
|
|
||||||
return rend.base();
|
|
||||||
}
|
|
||||||
|
|
||||||
static const std::string cmPropertySentinal = std::string();
|
|
||||||
|
|
||||||
cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const
|
cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const
|
||||||
{
|
{
|
||||||
std::vector<std::string>::const_iterator it =
|
return this->StateSnapshot.GetDirectory().GetIncludeDirectoriesEntries();
|
||||||
find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal);
|
|
||||||
return cmMakeRange(it, this->IncludeDirectoriesEntries.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmBacktraceRange cmMakefile::GetIncludeDirectoriesBacktraces() const
|
cmBacktraceRange cmMakefile::GetIncludeDirectoriesBacktraces() const
|
||||||
{
|
{
|
||||||
std::vector<std::string>::const_iterator it =
|
return this->StateSnapshot.GetDirectory()
|
||||||
find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal);
|
.GetIncludeDirectoriesEntryBacktraces();
|
||||||
std::vector<cmListFileBacktrace>::const_iterator btIt =
|
|
||||||
this->IncludeDirectoriesEntryBacktraces.begin()
|
|
||||||
+ std::distance(this->IncludeDirectoriesEntries.begin(), it);
|
|
||||||
return cmMakeRange(
|
|
||||||
btIt, this->IncludeDirectoriesEntryBacktraces.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmStringRange cmMakefile::GetCompileOptionsEntries() const
|
cmStringRange cmMakefile::GetCompileOptionsEntries() const
|
||||||
{
|
{
|
||||||
std::vector<std::string>::const_iterator it =
|
return this->StateSnapshot.GetDirectory().GetCompileOptionsEntries();
|
||||||
find_backwards(this->CompileOptionsEntries, cmPropertySentinal);
|
|
||||||
return cmMakeRange(it, this->CompileOptionsEntries.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmBacktraceRange cmMakefile::GetCompileOptionsBacktraces() const
|
cmBacktraceRange cmMakefile::GetCompileOptionsBacktraces() const
|
||||||
{
|
{
|
||||||
std::vector<std::string>::const_iterator it =
|
return this->StateSnapshot.GetDirectory().GetCompileOptionsEntryBacktraces();
|
||||||
find_backwards(this->CompileOptionsEntries, cmPropertySentinal);
|
|
||||||
std::vector<cmListFileBacktrace>::const_iterator btIt =
|
|
||||||
this->CompileOptionsEntryBacktraces.begin()
|
|
||||||
+ std::distance(this->CompileOptionsEntries.begin(), it);
|
|
||||||
return cmMakeRange(
|
|
||||||
btIt, this->CompileOptionsEntryBacktraces.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmStringRange cmMakefile::GetCompileDefinitionsEntries() const
|
cmStringRange cmMakefile::GetCompileDefinitionsEntries() const
|
||||||
{
|
{
|
||||||
std::vector<std::string>::const_iterator it =
|
return this->StateSnapshot.GetDirectory().GetCompileDefinitionsEntries();
|
||||||
find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal);
|
|
||||||
return cmMakeRange(it, this->CompileDefinitionsEntries.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const
|
cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const
|
||||||
{
|
{
|
||||||
std::vector<cmListFileBacktrace>::const_iterator btIt =
|
return this->StateSnapshot.GetDirectory()
|
||||||
this->CompileDefinitionsEntryBacktraces.begin();
|
.GetCompileDefinitionsEntryBacktraces();
|
||||||
std::vector<std::string>::const_iterator it =
|
|
||||||
find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal)
|
|
||||||
+ std::distance(this->CompileDefinitionsEntries.begin(), it);
|
|
||||||
return cmMakeRange(
|
|
||||||
btIt, this->CompileDefinitionsEntryBacktraces.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -1591,62 +1559,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
|
||||||
this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
|
this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
|
||||||
this->GetCurrentBinaryDirectory());
|
this->GetCurrentBinaryDirectory());
|
||||||
|
|
||||||
{
|
this->StateSnapshot.InitializeFromParent();
|
||||||
std::vector<std::string>::const_iterator it =
|
|
||||||
find_backwards(parent->IncludeDirectoriesEntries, cmPropertySentinal);
|
|
||||||
std::vector<std::string>::const_iterator begin =
|
|
||||||
parent->IncludeDirectoriesEntries.begin();
|
|
||||||
std::vector<std::string>::const_iterator end =
|
|
||||||
parent->IncludeDirectoriesEntries.end();
|
|
||||||
this->IncludeDirectoriesEntries.insert(
|
|
||||||
this->IncludeDirectoriesEntries.end(), it, end);
|
|
||||||
|
|
||||||
std::vector<cmListFileBacktrace>::const_iterator btIt =
|
|
||||||
parent->IncludeDirectoriesEntryBacktraces.begin()
|
|
||||||
+ std::distance(begin, it);
|
|
||||||
std::vector<cmListFileBacktrace>::const_iterator btEnd =
|
|
||||||
parent->IncludeDirectoriesEntryBacktraces.end();
|
|
||||||
this->IncludeDirectoriesEntryBacktraces.insert(
|
|
||||||
this->IncludeDirectoriesEntryBacktraces.end(), btIt, btEnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<std::string>::const_iterator it =
|
|
||||||
find_backwards(parent->CompileOptionsEntries, cmPropertySentinal);
|
|
||||||
std::vector<std::string>::const_iterator begin =
|
|
||||||
parent->CompileOptionsEntries.begin();
|
|
||||||
std::vector<std::string>::const_iterator end =
|
|
||||||
parent->CompileOptionsEntries.end();
|
|
||||||
this->CompileOptionsEntries.insert(
|
|
||||||
this->CompileOptionsEntries.end(), it, end);
|
|
||||||
|
|
||||||
std::vector<cmListFileBacktrace>::const_iterator btIt =
|
|
||||||
parent->CompileOptionsEntryBacktraces.begin()
|
|
||||||
+ std::distance(begin, it);
|
|
||||||
std::vector<cmListFileBacktrace>::const_iterator btEnd =
|
|
||||||
parent->CompileOptionsEntryBacktraces.end();
|
|
||||||
this->CompileOptionsEntryBacktraces.insert(
|
|
||||||
this->CompileOptionsEntryBacktraces.end(), btIt, btEnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<std::string>::const_iterator it =
|
|
||||||
find_backwards(parent->CompileDefinitionsEntries, cmPropertySentinal);
|
|
||||||
std::vector<std::string>::const_iterator begin =
|
|
||||||
parent->CompileDefinitionsEntries.begin();
|
|
||||||
std::vector<std::string>::const_iterator end =
|
|
||||||
parent->CompileDefinitionsEntries.end();
|
|
||||||
this->CompileDefinitionsEntries.insert(
|
|
||||||
this->CompileDefinitionsEntries.end(), it, end);
|
|
||||||
|
|
||||||
std::vector<cmListFileBacktrace>::const_iterator btIt =
|
|
||||||
parent->CompileDefinitionsEntryBacktraces.begin()
|
|
||||||
+ std::distance(begin, it);
|
|
||||||
std::vector<cmListFileBacktrace>::const_iterator btEnd =
|
|
||||||
parent->CompileDefinitionsEntryBacktraces.end();
|
|
||||||
this->CompileDefinitionsEntryBacktraces.insert(
|
|
||||||
this->CompileDefinitionsEntryBacktraces.end(), btIt, btEnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
|
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
|
||||||
|
|
||||||
|
@ -1990,17 +1903,18 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string>::iterator position =
|
|
||||||
before ? this->IncludeDirectoriesEntries.begin()
|
|
||||||
: this->IncludeDirectoriesEntries.end();
|
|
||||||
std::vector<cmListFileBacktrace>::iterator btPos =
|
|
||||||
this->IncludeDirectoriesEntryBacktraces.begin()
|
|
||||||
+ std::distance(this->IncludeDirectoriesEntries.begin(), position);
|
|
||||||
|
|
||||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||||
std::string entryString = cmJoin(incs, ";");
|
std::string entryString = cmJoin(incs, ";");
|
||||||
this->IncludeDirectoriesEntries.insert(position, entryString);
|
if (before)
|
||||||
this->IncludeDirectoriesEntryBacktraces.insert(btPos, lfbt);
|
{
|
||||||
|
this->StateSnapshot.GetDirectory()
|
||||||
|
.PrependIncludeDirectoriesEntry(entryString, lfbt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->StateSnapshot.GetDirectory()
|
||||||
|
.AppendIncludeDirectoriesEntry(entryString, lfbt);
|
||||||
|
}
|
||||||
|
|
||||||
// Property on each target:
|
// Property on each target:
|
||||||
for (cmTargets::iterator l = this->Targets.begin();
|
for (cmTargets::iterator l = this->Targets.begin();
|
||||||
|
@ -4226,41 +4140,35 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
|
||||||
{
|
{
|
||||||
if (prop == "INCLUDE_DIRECTORIES")
|
if (prop == "INCLUDE_DIRECTORIES")
|
||||||
{
|
{
|
||||||
this->IncludeDirectoriesEntries.push_back(cmPropertySentinal);
|
|
||||||
this->IncludeDirectoriesEntryBacktraces.push_back(cmListFileBacktrace());
|
|
||||||
if (!value)
|
if (!value)
|
||||||
{
|
{
|
||||||
|
this->StateSnapshot.GetDirectory().ClearIncludeDirectories();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||||
this->IncludeDirectoriesEntries.push_back(value);
|
this->StateSnapshot.GetDirectory().SetIncludeDirectories(value, lfbt);
|
||||||
this->IncludeDirectoriesEntryBacktraces.push_back(lfbt);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prop == "COMPILE_OPTIONS")
|
if (prop == "COMPILE_OPTIONS")
|
||||||
{
|
{
|
||||||
this->CompileOptionsEntries.push_back(cmPropertySentinal);
|
|
||||||
this->CompileDefinitionsEntryBacktraces.push_back(cmListFileBacktrace());
|
|
||||||
if (!value)
|
if (!value)
|
||||||
{
|
{
|
||||||
|
this->StateSnapshot.GetDirectory().ClearCompileOptions();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||||
this->CompileOptionsEntries.push_back(value);
|
this->StateSnapshot.GetDirectory().SetCompileOptions(value, lfbt);
|
||||||
this->CompileOptionsEntryBacktraces.push_back(lfbt);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prop == "COMPILE_DEFINITIONS")
|
if (prop == "COMPILE_DEFINITIONS")
|
||||||
{
|
{
|
||||||
this->CompileDefinitionsEntries.push_back(cmPropertySentinal);
|
|
||||||
this->CompileDefinitionsEntryBacktraces.push_back(cmListFileBacktrace());
|
|
||||||
if (!value)
|
if (!value)
|
||||||
{
|
{
|
||||||
|
this->StateSnapshot.GetDirectory().ClearCompileDefinitions();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||||
this->CompileDefinitionsEntries.push_back(value);
|
this->StateSnapshot.GetDirectory().SetCompileDefinitions(value, lfbt);
|
||||||
this->CompileDefinitionsEntryBacktraces.push_back(lfbt);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4274,22 +4182,21 @@ void cmMakefile::AppendProperty(const std::string& prop,
|
||||||
if (prop == "INCLUDE_DIRECTORIES")
|
if (prop == "INCLUDE_DIRECTORIES")
|
||||||
{
|
{
|
||||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||||
this->IncludeDirectoriesEntries.push_back(value);
|
this->StateSnapshot.GetDirectory().AppendIncludeDirectoriesEntry(value,
|
||||||
this->IncludeDirectoriesEntryBacktraces.push_back(lfbt);
|
lfbt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prop == "COMPILE_OPTIONS")
|
if (prop == "COMPILE_OPTIONS")
|
||||||
{
|
{
|
||||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||||
this->CompileOptionsEntries.push_back(value);
|
this->StateSnapshot.GetDirectory().AppendCompileOptionsEntry(value, lfbt);
|
||||||
this->CompileOptionsEntryBacktraces.push_back(lfbt);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prop == "COMPILE_DEFINITIONS")
|
if (prop == "COMPILE_DEFINITIONS")
|
||||||
{
|
{
|
||||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||||
this->CompileDefinitionsEntries.push_back(value);
|
this->StateSnapshot.GetDirectory().AppendCompileDefinitionsEntry(value,
|
||||||
this->CompileDefinitionsEntryBacktraces.push_back(lfbt);
|
lfbt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4344,25 +4251,20 @@ const char *cmMakefile::GetProperty(const std::string& prop,
|
||||||
}
|
}
|
||||||
else if (prop == "INCLUDE_DIRECTORIES")
|
else if (prop == "INCLUDE_DIRECTORIES")
|
||||||
{
|
{
|
||||||
std::vector<std::string>::const_iterator it =
|
output = cmJoin(this->StateSnapshot.GetDirectory()
|
||||||
find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal);
|
.GetIncludeDirectoriesEntries(), ";");
|
||||||
output = cmJoin(cmMakeRange(it, this->IncludeDirectoriesEntries.end()),
|
|
||||||
";");
|
|
||||||
return output.c_str();
|
return output.c_str();
|
||||||
}
|
}
|
||||||
else if (prop == "COMPILE_OPTIONS")
|
else if (prop == "COMPILE_OPTIONS")
|
||||||
{
|
{
|
||||||
std::vector<std::string>::const_iterator it =
|
output = cmJoin(this->StateSnapshot.GetDirectory()
|
||||||
find_backwards(this->CompileOptionsEntries, cmPropertySentinal);
|
.GetCompileOptionsEntries(), ";");
|
||||||
output = cmJoin(cmMakeRange(it, this->CompileOptionsEntries.end()), ";");
|
|
||||||
return output.c_str();
|
return output.c_str();
|
||||||
}
|
}
|
||||||
else if (prop == "COMPILE_DEFINITIONS")
|
else if (prop == "COMPILE_DEFINITIONS")
|
||||||
{
|
{
|
||||||
std::vector<std::string>::const_iterator it =
|
output = cmJoin(this->StateSnapshot.GetDirectory()
|
||||||
find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal);
|
.GetCompileDefinitionsEntries(), ";");
|
||||||
output = cmJoin(cmMakeRange(it, this->CompileDefinitionsEntries.end()),
|
|
||||||
";");
|
|
||||||
return output.c_str();
|
return output.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -846,13 +846,6 @@ protected:
|
||||||
std::vector<std::string> HeaderFileExtensions;
|
std::vector<std::string> HeaderFileExtensions;
|
||||||
std::string DefineFlags;
|
std::string DefineFlags;
|
||||||
|
|
||||||
std::vector<std::string> IncludeDirectoriesEntries;
|
|
||||||
std::vector<cmListFileBacktrace> IncludeDirectoriesEntryBacktraces;
|
|
||||||
std::vector<std::string> CompileOptionsEntries;
|
|
||||||
std::vector<cmListFileBacktrace> CompileOptionsEntryBacktraces;
|
|
||||||
std::vector<std::string> CompileDefinitionsEntries;
|
|
||||||
std::vector<cmListFileBacktrace> CompileDefinitionsEntryBacktraces;
|
|
||||||
|
|
||||||
// Track the value of the computed DEFINITIONS property.
|
// Track the value of the computed DEFINITIONS property.
|
||||||
void AddDefineFlag(const char*, std::string&);
|
void AddDefineFlag(const char*, std::string&);
|
||||||
void RemoveDefineFlag(const char*, std::string::size_type, std::string&);
|
void RemoveDefineFlag(const char*, std::string::size_type, std::string&);
|
||||||
|
|
|
@ -28,6 +28,9 @@ struct cmState::SnapshotDataType
|
||||||
BuildSystemDirectory;
|
BuildSystemDirectory;
|
||||||
std::string EntryPointCommand;
|
std::string EntryPointCommand;
|
||||||
long EntryPointLine;
|
long EntryPointLine;
|
||||||
|
std::vector<std::string>::size_type IncludeDirectoryPosition;
|
||||||
|
std::vector<std::string>::size_type CompileDefinitionsPosition;
|
||||||
|
std::vector<std::string>::size_type CompileOptionsPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmState::BuildsystemDirectoryStateType
|
struct cmState::BuildsystemDirectoryStateType
|
||||||
|
@ -44,6 +47,15 @@ struct cmState::BuildsystemDirectoryStateType
|
||||||
// safely by the build tools.
|
// safely by the build tools.
|
||||||
std::string RelativePathTopSource;
|
std::string RelativePathTopSource;
|
||||||
std::string RelativePathTopBinary;
|
std::string RelativePathTopBinary;
|
||||||
|
|
||||||
|
std::vector<std::string> IncludeDirectories;
|
||||||
|
std::vector<cmListFileBacktrace> IncludeDirectoryBacktraces;
|
||||||
|
|
||||||
|
std::vector<std::string> CompileDefinitions;
|
||||||
|
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
|
||||||
|
|
||||||
|
std::vector<std::string> CompileOptions;
|
||||||
|
std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
|
||||||
};
|
};
|
||||||
|
|
||||||
cmState::cmState(cmake* cm)
|
cmState::cmState(cmake* cm)
|
||||||
|
@ -228,7 +240,16 @@ cmState::Snapshot cmState::Reset()
|
||||||
this->GlobalProperties.clear();
|
this->GlobalProperties.clear();
|
||||||
this->PropertyDefinitions.clear();
|
this->PropertyDefinitions.clear();
|
||||||
|
|
||||||
this->BuildsystemDirectory.Truncate();
|
{
|
||||||
|
cmLinkedTree<BuildsystemDirectoryStateType>::iterator it =
|
||||||
|
this->BuildsystemDirectory.Truncate();
|
||||||
|
it->IncludeDirectories.clear();
|
||||||
|
it->IncludeDirectoryBacktraces.clear();
|
||||||
|
it->CompileDefinitions.clear();
|
||||||
|
it->CompileDefinitionsBacktraces.clear();
|
||||||
|
it->CompileOptions.clear();
|
||||||
|
it->CompileOptionsBacktraces.clear();
|
||||||
|
}
|
||||||
PositionType pos = this->SnapshotData.Truncate();
|
PositionType pos = this->SnapshotData.Truncate();
|
||||||
this->ExecutionListFiles.Truncate();
|
this->ExecutionListFiles.Truncate();
|
||||||
|
|
||||||
|
@ -698,6 +719,9 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
|
||||||
this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
|
this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
|
||||||
pos->ExecutionListFile =
|
pos->ExecutionListFile =
|
||||||
this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root());
|
this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root());
|
||||||
|
pos->IncludeDirectoryPosition = 0;
|
||||||
|
pos->CompileDefinitionsPosition = 0;
|
||||||
|
pos->CompileOptionsPosition = 0;
|
||||||
return cmState::Snapshot(this, pos);
|
return cmState::Snapshot(this, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,6 +820,13 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot)
|
||||||
PositionType pos = originSnapshot.Position;
|
PositionType pos = originSnapshot.Position;
|
||||||
PositionType prevPos = pos;
|
PositionType prevPos = pos;
|
||||||
++prevPos;
|
++prevPos;
|
||||||
|
prevPos->IncludeDirectoryPosition =
|
||||||
|
prevPos->BuildSystemDirectory->IncludeDirectories.size();
|
||||||
|
prevPos->CompileDefinitionsPosition =
|
||||||
|
prevPos->BuildSystemDirectory->CompileDefinitions.size();
|
||||||
|
prevPos->CompileOptionsPosition =
|
||||||
|
prevPos->BuildSystemDirectory->CompileOptions.size();
|
||||||
|
|
||||||
if (prevPos == this->SnapshotData.Root())
|
if (prevPos == this->SnapshotData.Root())
|
||||||
{
|
{
|
||||||
return Snapshot(this, prevPos);
|
return Snapshot(this, prevPos);
|
||||||
|
@ -949,6 +980,62 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
|
||||||
return snapshot;
|
return snapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const std::string cmPropertySentinal = std::string();
|
||||||
|
|
||||||
|
template<typename T, typename U, typename V>
|
||||||
|
void InitializeContentFromParent(T& parentContent,
|
||||||
|
T& thisContent,
|
||||||
|
U& parentBacktraces,
|
||||||
|
U& thisBacktraces,
|
||||||
|
V& contentEndPosition)
|
||||||
|
{
|
||||||
|
std::vector<std::string>::const_iterator parentBegin =
|
||||||
|
parentContent.begin();
|
||||||
|
std::vector<std::string>::const_iterator parentEnd =
|
||||||
|
parentContent.end();
|
||||||
|
|
||||||
|
std::vector<std::string>::const_reverse_iterator parentRbegin =
|
||||||
|
cmMakeReverseIterator(parentEnd);
|
||||||
|
std::vector<std::string>::const_reverse_iterator parentRend =
|
||||||
|
parentContent.rend();
|
||||||
|
parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal);
|
||||||
|
std::vector<std::string>::const_iterator parentIt = parentRbegin.base();
|
||||||
|
|
||||||
|
thisContent = std::vector<std::string>(parentIt, parentEnd);
|
||||||
|
|
||||||
|
std::vector<cmListFileBacktrace>::const_iterator btIt =
|
||||||
|
parentBacktraces.begin() + std::distance(parentBegin, parentIt);
|
||||||
|
std::vector<cmListFileBacktrace>::const_iterator btEnd =
|
||||||
|
parentBacktraces.end();
|
||||||
|
|
||||||
|
thisBacktraces = std::vector<cmListFileBacktrace>(btIt, btEnd);
|
||||||
|
|
||||||
|
contentEndPosition = thisContent.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::Snapshot::InitializeFromParent()
|
||||||
|
{
|
||||||
|
PositionType parent = this->Position->DirectoryParent;
|
||||||
|
|
||||||
|
InitializeContentFromParent(parent->BuildSystemDirectory->IncludeDirectories,
|
||||||
|
this->Position->BuildSystemDirectory->IncludeDirectories,
|
||||||
|
parent->BuildSystemDirectory->IncludeDirectoryBacktraces,
|
||||||
|
this->Position->BuildSystemDirectory->IncludeDirectoryBacktraces,
|
||||||
|
this->Position->IncludeDirectoryPosition);
|
||||||
|
|
||||||
|
InitializeContentFromParent(parent->BuildSystemDirectory->CompileDefinitions,
|
||||||
|
this->Position->BuildSystemDirectory->CompileDefinitions,
|
||||||
|
parent->BuildSystemDirectory->CompileDefinitionsBacktraces,
|
||||||
|
this->Position->BuildSystemDirectory->CompileDefinitionsBacktraces,
|
||||||
|
this->Position->CompileDefinitionsPosition);
|
||||||
|
|
||||||
|
InitializeContentFromParent(parent->BuildSystemDirectory->CompileOptions,
|
||||||
|
this->Position->BuildSystemDirectory->CompileOptions,
|
||||||
|
parent->BuildSystemDirectory->CompileOptionsBacktraces,
|
||||||
|
this->Position->BuildSystemDirectory->CompileOptionsBacktraces,
|
||||||
|
this->Position->CompileOptionsPosition);
|
||||||
|
}
|
||||||
|
|
||||||
cmState* cmState::Snapshot::GetState() const
|
cmState* cmState::Snapshot::GetState() const
|
||||||
{
|
{
|
||||||
return this->State;
|
return this->State;
|
||||||
|
@ -966,3 +1053,220 @@ cmState::Directory::Directory(
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
cmStringRange GetPropertyContent(T const& content, U contentEndPosition)
|
||||||
|
{
|
||||||
|
std::vector<std::string>::const_iterator end =
|
||||||
|
content.begin() + contentEndPosition;
|
||||||
|
|
||||||
|
std::vector<std::string>::const_reverse_iterator rbegin =
|
||||||
|
cmMakeReverseIterator(end);
|
||||||
|
rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
|
||||||
|
|
||||||
|
return cmMakeRange(rbegin.base(), end);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U, typename V>
|
||||||
|
cmBacktraceRange GetPropertyBacktraces(T const& content,
|
||||||
|
U const& backtraces,
|
||||||
|
V contentEndPosition)
|
||||||
|
{
|
||||||
|
std::vector<std::string>::const_iterator entryEnd =
|
||||||
|
content.begin() + contentEndPosition;
|
||||||
|
|
||||||
|
std::vector<std::string>::const_reverse_iterator rbegin =
|
||||||
|
cmMakeReverseIterator(entryEnd);
|
||||||
|
rbegin = std::find(rbegin, content.rend(), cmPropertySentinal);
|
||||||
|
|
||||||
|
std::vector<cmListFileBacktrace>::const_iterator it =
|
||||||
|
backtraces.begin() + std::distance(content.begin(), rbegin.base());
|
||||||
|
|
||||||
|
std::vector<cmListFileBacktrace>::const_iterator end = backtraces.end();
|
||||||
|
return cmMakeRange(it, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U, typename V>
|
||||||
|
void AppendEntry(T& content, U& backtraces, V& endContentPosition,
|
||||||
|
const std::string& vec, const cmListFileBacktrace& lfbt)
|
||||||
|
{
|
||||||
|
assert(endContentPosition == content.size());
|
||||||
|
|
||||||
|
content.push_back(vec);
|
||||||
|
backtraces.push_back(lfbt);
|
||||||
|
|
||||||
|
endContentPosition = content.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U, typename V>
|
||||||
|
void SetContent(T& content, U& backtraces, V& endContentPosition,
|
||||||
|
const std::string& vec, const cmListFileBacktrace& lfbt)
|
||||||
|
{
|
||||||
|
assert(endContentPosition == content.size());
|
||||||
|
|
||||||
|
content.resize(content.size() + 2);
|
||||||
|
backtraces.resize(backtraces.size() + 2);
|
||||||
|
|
||||||
|
content.back() = vec;
|
||||||
|
backtraces.back() = lfbt;
|
||||||
|
|
||||||
|
endContentPosition = content.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U, typename V>
|
||||||
|
void ClearContent(T& content, U& backtraces, V& endContentPosition)
|
||||||
|
{
|
||||||
|
assert(endContentPosition == content.size());
|
||||||
|
|
||||||
|
content.resize(content.size() + 1);
|
||||||
|
backtraces.resize(backtraces.size() + 1);
|
||||||
|
|
||||||
|
endContentPosition = content.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
cmStringRange
|
||||||
|
cmState::Directory::GetIncludeDirectoriesEntries() const
|
||||||
|
{
|
||||||
|
return GetPropertyContent(this->DirectoryState->IncludeDirectories,
|
||||||
|
this->Snapshot_.Position->IncludeDirectoryPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmBacktraceRange
|
||||||
|
cmState::Directory::GetIncludeDirectoriesEntryBacktraces() const
|
||||||
|
{
|
||||||
|
return GetPropertyBacktraces(this->DirectoryState->IncludeDirectories,
|
||||||
|
this->DirectoryState->IncludeDirectoryBacktraces,
|
||||||
|
this->Snapshot_.Position->IncludeDirectoryPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::Directory::AppendIncludeDirectoriesEntry(
|
||||||
|
const std::string& vec, const cmListFileBacktrace& lfbt)
|
||||||
|
{
|
||||||
|
AppendEntry(this->DirectoryState->IncludeDirectories,
|
||||||
|
this->DirectoryState->IncludeDirectoryBacktraces,
|
||||||
|
this->Snapshot_.Position->IncludeDirectoryPosition,
|
||||||
|
vec, lfbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::Directory::PrependIncludeDirectoriesEntry(
|
||||||
|
const std::string& vec, const cmListFileBacktrace& lfbt)
|
||||||
|
{
|
||||||
|
std::vector<std::string>::iterator entryEnd =
|
||||||
|
this->DirectoryState->IncludeDirectories.begin()
|
||||||
|
+ this->Snapshot_.Position->IncludeDirectoryPosition;
|
||||||
|
|
||||||
|
std::vector<std::string>::const_reverse_iterator rend =
|
||||||
|
this->DirectoryState->IncludeDirectories.rend();
|
||||||
|
std::vector<std::string>::reverse_iterator rbegin =
|
||||||
|
cmMakeReverseIterator(entryEnd);
|
||||||
|
std::vector<std::string>::const_reverse_iterator crbegin = rbegin;
|
||||||
|
crbegin = std::find(crbegin, rend, cmPropertySentinal);
|
||||||
|
|
||||||
|
std::vector<std::string>::const_iterator entryIt = crbegin.base();
|
||||||
|
std::vector<std::string>::const_iterator entryBegin =
|
||||||
|
this->DirectoryState->IncludeDirectories.begin();
|
||||||
|
|
||||||
|
std::vector<cmListFileBacktrace>::iterator btIt =
|
||||||
|
this->DirectoryState->IncludeDirectoryBacktraces.begin()
|
||||||
|
+ std::distance(entryBegin, entryIt);
|
||||||
|
|
||||||
|
this->DirectoryState->IncludeDirectories.insert(rbegin.base(), vec);
|
||||||
|
this->DirectoryState->IncludeDirectoryBacktraces.insert(btIt, lfbt);
|
||||||
|
|
||||||
|
this->Snapshot_.Position->IncludeDirectoryPosition =
|
||||||
|
this->DirectoryState->IncludeDirectories.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::Directory::SetIncludeDirectories(
|
||||||
|
const std::string& vec, const cmListFileBacktrace& lfbt)
|
||||||
|
{
|
||||||
|
SetContent(this->DirectoryState->IncludeDirectories,
|
||||||
|
this->DirectoryState->IncludeDirectoryBacktraces,
|
||||||
|
this->Snapshot_.Position->IncludeDirectoryPosition,
|
||||||
|
vec, lfbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::Directory::ClearIncludeDirectories()
|
||||||
|
{
|
||||||
|
ClearContent(this->DirectoryState->IncludeDirectories,
|
||||||
|
this->DirectoryState->IncludeDirectoryBacktraces,
|
||||||
|
this->Snapshot_.Position->IncludeDirectoryPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmStringRange cmState::Directory::GetCompileDefinitionsEntries() const
|
||||||
|
{
|
||||||
|
return GetPropertyContent(this->DirectoryState->CompileDefinitions,
|
||||||
|
this->Snapshot_.Position->CompileDefinitionsPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmBacktraceRange
|
||||||
|
cmState::Directory::GetCompileDefinitionsEntryBacktraces() const
|
||||||
|
{
|
||||||
|
return GetPropertyBacktraces(this->DirectoryState->CompileDefinitions,
|
||||||
|
this->DirectoryState->CompileDefinitionsBacktraces,
|
||||||
|
this->Snapshot_.Position->CompileDefinitionsPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::Directory::AppendCompileDefinitionsEntry(const std::string& vec,
|
||||||
|
const cmListFileBacktrace& lfbt)
|
||||||
|
{
|
||||||
|
AppendEntry(this->DirectoryState->CompileDefinitions,
|
||||||
|
this->DirectoryState->CompileDefinitionsBacktraces,
|
||||||
|
this->Snapshot_.Position->CompileDefinitionsPosition,
|
||||||
|
vec, lfbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::Directory::SetCompileDefinitions(const std::string& vec,
|
||||||
|
const cmListFileBacktrace& lfbt)
|
||||||
|
{
|
||||||
|
SetContent(this->DirectoryState->CompileDefinitions,
|
||||||
|
this->DirectoryState->CompileDefinitionsBacktraces,
|
||||||
|
this->Snapshot_.Position->CompileDefinitionsPosition,
|
||||||
|
vec, lfbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::Directory::ClearCompileDefinitions()
|
||||||
|
{
|
||||||
|
ClearContent(this->DirectoryState->CompileDefinitions,
|
||||||
|
this->DirectoryState->CompileDefinitionsBacktraces,
|
||||||
|
this->Snapshot_.Position->CompileDefinitionsPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmStringRange cmState::Directory::GetCompileOptionsEntries() const
|
||||||
|
{
|
||||||
|
return GetPropertyContent(this->DirectoryState->CompileOptions,
|
||||||
|
this->Snapshot_.Position->CompileOptionsPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmBacktraceRange cmState::Directory::GetCompileOptionsEntryBacktraces() const
|
||||||
|
{
|
||||||
|
return GetPropertyBacktraces(this->DirectoryState->CompileOptions,
|
||||||
|
this->DirectoryState->CompileOptionsBacktraces,
|
||||||
|
this->Snapshot_.Position->CompileOptionsPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cmState::Directory::AppendCompileOptionsEntry(const std::string& vec,
|
||||||
|
const cmListFileBacktrace& lfbt)
|
||||||
|
{
|
||||||
|
AppendEntry(this->DirectoryState->CompileOptions,
|
||||||
|
this->DirectoryState->CompileOptionsBacktraces,
|
||||||
|
this->Snapshot_.Position->CompileOptionsPosition,
|
||||||
|
vec, lfbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::Directory::SetCompileOptions(const std::string& vec,
|
||||||
|
const cmListFileBacktrace& lfbt)
|
||||||
|
{
|
||||||
|
SetContent(this->DirectoryState->CompileOptions,
|
||||||
|
this->DirectoryState->CompileOptionsBacktraces,
|
||||||
|
this->Snapshot_.Position->CompileOptionsPosition,
|
||||||
|
vec, lfbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmState::Directory::ClearCompileOptions()
|
||||||
|
{
|
||||||
|
ClearContent(this->DirectoryState->CompileOptions,
|
||||||
|
this->DirectoryState->CompileOptionsBacktraces,
|
||||||
|
this->Snapshot_.Position->CompileOptionsPosition);
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "cmPropertyDefinitionMap.h"
|
#include "cmPropertyDefinitionMap.h"
|
||||||
#include "cmPropertyMap.h"
|
#include "cmPropertyMap.h"
|
||||||
#include "cmLinkedTree.h"
|
#include "cmLinkedTree.h"
|
||||||
|
#include "cmAlgorithms.h"
|
||||||
|
|
||||||
class cmake;
|
class cmake;
|
||||||
class cmCommand;
|
class cmCommand;
|
||||||
|
@ -56,6 +57,8 @@ public:
|
||||||
Snapshot GetBuildsystemDirectoryParent() const;
|
Snapshot GetBuildsystemDirectoryParent() const;
|
||||||
Snapshot GetCallStackParent() const;
|
Snapshot GetCallStackParent() const;
|
||||||
|
|
||||||
|
void InitializeFromParent();
|
||||||
|
|
||||||
cmState* GetState() const;
|
cmState* GetState() const;
|
||||||
|
|
||||||
Directory GetDirectory() const;
|
Directory GetDirectory() const;
|
||||||
|
@ -87,6 +90,32 @@ public:
|
||||||
void SetRelativePathTopSource(const char* dir);
|
void SetRelativePathTopSource(const char* dir);
|
||||||
void SetRelativePathTopBinary(const char* dir);
|
void SetRelativePathTopBinary(const char* dir);
|
||||||
|
|
||||||
|
cmStringRange GetIncludeDirectoriesEntries() const;
|
||||||
|
cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const;
|
||||||
|
void AppendIncludeDirectoriesEntry(std::string const& vec,
|
||||||
|
cmListFileBacktrace const& lfbt);
|
||||||
|
void PrependIncludeDirectoriesEntry(std::string const& vec,
|
||||||
|
cmListFileBacktrace const& lfbt);
|
||||||
|
void SetIncludeDirectories(std::string const& vec,
|
||||||
|
cmListFileBacktrace const& lfbt);
|
||||||
|
void ClearIncludeDirectories();
|
||||||
|
|
||||||
|
cmStringRange GetCompileDefinitionsEntries() const;
|
||||||
|
cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const;
|
||||||
|
void AppendCompileDefinitionsEntry(std::string const& vec,
|
||||||
|
cmListFileBacktrace const& lfbt);
|
||||||
|
void SetCompileDefinitions(std::string const& vec,
|
||||||
|
cmListFileBacktrace const& lfbt);
|
||||||
|
void ClearCompileDefinitions();
|
||||||
|
|
||||||
|
cmStringRange GetCompileOptionsEntries() const;
|
||||||
|
cmBacktraceRange GetCompileOptionsEntryBacktraces() const;
|
||||||
|
void AppendCompileOptionsEntry(std::string const& vec,
|
||||||
|
cmListFileBacktrace const& lfbt);
|
||||||
|
void SetCompileOptions(std::string const& vec,
|
||||||
|
cmListFileBacktrace const& lfbt);
|
||||||
|
void ClearCompileOptions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ComputeRelativePathTopSource();
|
void ComputeRelativePathTopSource();
|
||||||
void ComputeRelativePathTopBinary();
|
void ComputeRelativePathTopBinary();
|
||||||
|
|
Loading…
Reference in New Issue