cmState: Host buildsystem properties for directories.

This commit is contained in:
Stephen Kelly 2015-07-18 12:28:49 +02:00
parent 8f0a5d84e3
commit 6ed9c7e024
4 changed files with 370 additions and 142 deletions

View File

@ -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
{
std::vector<std::string>::const_iterator it =
find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal);
return cmMakeRange(it, this->IncludeDirectoriesEntries.end());
return this->StateSnapshot.GetDirectory().GetIncludeDirectoriesEntries();
}
cmBacktraceRange cmMakefile::GetIncludeDirectoriesBacktraces() const
{
std::vector<std::string>::const_iterator it =
find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal);
std::vector<cmListFileBacktrace>::const_iterator btIt =
this->IncludeDirectoriesEntryBacktraces.begin()
+ std::distance(this->IncludeDirectoriesEntries.begin(), it);
return cmMakeRange(
btIt, this->IncludeDirectoriesEntryBacktraces.end());
return this->StateSnapshot.GetDirectory()
.GetIncludeDirectoriesEntryBacktraces();
}
cmStringRange cmMakefile::GetCompileOptionsEntries() const
{
std::vector<std::string>::const_iterator it =
find_backwards(this->CompileOptionsEntries, cmPropertySentinal);
return cmMakeRange(it, this->CompileOptionsEntries.end());
return this->StateSnapshot.GetDirectory().GetCompileOptionsEntries();
}
cmBacktraceRange cmMakefile::GetCompileOptionsBacktraces() const
{
std::vector<std::string>::const_iterator it =
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());
return this->StateSnapshot.GetDirectory().GetCompileOptionsEntryBacktraces();
}
cmStringRange cmMakefile::GetCompileDefinitionsEntries() const
{
std::vector<std::string>::const_iterator it =
find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal);
return cmMakeRange(it, this->CompileDefinitionsEntries.end());
return this->StateSnapshot.GetDirectory().GetCompileDefinitionsEntries();
}
cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const
{
std::vector<cmListFileBacktrace>::const_iterator btIt =
this->CompileDefinitionsEntryBacktraces.begin();
std::vector<std::string>::const_iterator it =
find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal)
+ std::distance(this->CompileDefinitionsEntries.begin(), it);
return cmMakeRange(
btIt, this->CompileDefinitionsEntryBacktraces.end());
return this->StateSnapshot.GetDirectory()
.GetCompileDefinitionsEntryBacktraces();
}
//----------------------------------------------------------------------------
@ -1591,62 +1559,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
this->GetCurrentBinaryDirectory());
{
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->StateSnapshot.InitializeFromParent();
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
@ -1990,17 +1903,18 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
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();
std::string entryString = cmJoin(incs, ";");
this->IncludeDirectoriesEntries.insert(position, entryString);
this->IncludeDirectoriesEntryBacktraces.insert(btPos, lfbt);
if (before)
{
this->StateSnapshot.GetDirectory()
.PrependIncludeDirectoriesEntry(entryString, lfbt);
}
else
{
this->StateSnapshot.GetDirectory()
.AppendIncludeDirectoriesEntry(entryString, lfbt);
}
// Property on each target:
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")
{
this->IncludeDirectoriesEntries.push_back(cmPropertySentinal);
this->IncludeDirectoriesEntryBacktraces.push_back(cmListFileBacktrace());
if (!value)
{
this->StateSnapshot.GetDirectory().ClearIncludeDirectories();
return;
}
cmListFileBacktrace lfbt = this->GetBacktrace();
this->IncludeDirectoriesEntries.push_back(value);
this->IncludeDirectoriesEntryBacktraces.push_back(lfbt);
this->StateSnapshot.GetDirectory().SetIncludeDirectories(value, lfbt);
return;
}
if (prop == "COMPILE_OPTIONS")
{
this->CompileOptionsEntries.push_back(cmPropertySentinal);
this->CompileDefinitionsEntryBacktraces.push_back(cmListFileBacktrace());
if (!value)
{
this->StateSnapshot.GetDirectory().ClearCompileOptions();
return;
}
cmListFileBacktrace lfbt = this->GetBacktrace();
this->CompileOptionsEntries.push_back(value);
this->CompileOptionsEntryBacktraces.push_back(lfbt);
this->StateSnapshot.GetDirectory().SetCompileOptions(value, lfbt);
return;
}
if (prop == "COMPILE_DEFINITIONS")
{
this->CompileDefinitionsEntries.push_back(cmPropertySentinal);
this->CompileDefinitionsEntryBacktraces.push_back(cmListFileBacktrace());
if (!value)
{
this->StateSnapshot.GetDirectory().ClearCompileDefinitions();
return;
}
cmListFileBacktrace lfbt = this->GetBacktrace();
this->CompileDefinitionsEntries.push_back(value);
this->CompileDefinitionsEntryBacktraces.push_back(lfbt);
this->StateSnapshot.GetDirectory().SetCompileDefinitions(value, lfbt);
return;
}
@ -4274,22 +4182,21 @@ void cmMakefile::AppendProperty(const std::string& prop,
if (prop == "INCLUDE_DIRECTORIES")
{
cmListFileBacktrace lfbt = this->GetBacktrace();
this->IncludeDirectoriesEntries.push_back(value);
this->IncludeDirectoriesEntryBacktraces.push_back(lfbt);
this->StateSnapshot.GetDirectory().AppendIncludeDirectoriesEntry(value,
lfbt);
return;
}
if (prop == "COMPILE_OPTIONS")
{
cmListFileBacktrace lfbt = this->GetBacktrace();
this->CompileOptionsEntries.push_back(value);
this->CompileOptionsEntryBacktraces.push_back(lfbt);
this->StateSnapshot.GetDirectory().AppendCompileOptionsEntry(value, lfbt);
return;
}
if (prop == "COMPILE_DEFINITIONS")
{
cmListFileBacktrace lfbt = this->GetBacktrace();
this->CompileDefinitionsEntries.push_back(value);
this->CompileDefinitionsEntryBacktraces.push_back(lfbt);
this->StateSnapshot.GetDirectory().AppendCompileDefinitionsEntry(value,
lfbt);
return;
}
@ -4344,25 +4251,20 @@ const char *cmMakefile::GetProperty(const std::string& prop,
}
else if (prop == "INCLUDE_DIRECTORIES")
{
std::vector<std::string>::const_iterator it =
find_backwards(this->IncludeDirectoriesEntries, cmPropertySentinal);
output = cmJoin(cmMakeRange(it, this->IncludeDirectoriesEntries.end()),
";");
output = cmJoin(this->StateSnapshot.GetDirectory()
.GetIncludeDirectoriesEntries(), ";");
return output.c_str();
}
else if (prop == "COMPILE_OPTIONS")
{
std::vector<std::string>::const_iterator it =
find_backwards(this->CompileOptionsEntries, cmPropertySentinal);
output = cmJoin(cmMakeRange(it, this->CompileOptionsEntries.end()), ";");
output = cmJoin(this->StateSnapshot.GetDirectory()
.GetCompileOptionsEntries(), ";");
return output.c_str();
}
else if (prop == "COMPILE_DEFINITIONS")
{
std::vector<std::string>::const_iterator it =
find_backwards(this->CompileDefinitionsEntries, cmPropertySentinal);
output = cmJoin(cmMakeRange(it, this->CompileDefinitionsEntries.end()),
";");
output = cmJoin(this->StateSnapshot.GetDirectory()
.GetCompileDefinitionsEntries(), ";");
return output.c_str();
}

View File

@ -846,13 +846,6 @@ protected:
std::vector<std::string> HeaderFileExtensions;
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.
void AddDefineFlag(const char*, std::string&);
void RemoveDefineFlag(const char*, std::string::size_type, std::string&);

View File

@ -28,6 +28,9 @@ struct cmState::SnapshotDataType
BuildSystemDirectory;
std::string EntryPointCommand;
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
@ -44,6 +47,15 @@ struct cmState::BuildsystemDirectoryStateType
// safely by the build tools.
std::string RelativePathTopSource;
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)
@ -228,7 +240,16 @@ cmState::Snapshot cmState::Reset()
this->GlobalProperties.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();
this->ExecutionListFiles.Truncate();
@ -698,6 +719,9 @@ cmState::Snapshot cmState::CreateBaseSnapshot()
this->BuildsystemDirectory.Extend(this->BuildsystemDirectory.Root());
pos->ExecutionListFile =
this->ExecutionListFiles.Extend(this->ExecutionListFiles.Root());
pos->IncludeDirectoryPosition = 0;
pos->CompileDefinitionsPosition = 0;
pos->CompileOptionsPosition = 0;
return cmState::Snapshot(this, pos);
}
@ -796,6 +820,13 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot)
PositionType pos = originSnapshot.Position;
PositionType prevPos = pos;
++prevPos;
prevPos->IncludeDirectoryPosition =
prevPos->BuildSystemDirectory->IncludeDirectories.size();
prevPos->CompileDefinitionsPosition =
prevPos->BuildSystemDirectory->CompileDefinitions.size();
prevPos->CompileOptionsPosition =
prevPos->BuildSystemDirectory->CompileOptions.size();
if (prevPos == this->SnapshotData.Root())
{
return Snapshot(this, prevPos);
@ -949,6 +980,62 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const
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
{
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);
}

View File

@ -16,6 +16,7 @@
#include "cmPropertyDefinitionMap.h"
#include "cmPropertyMap.h"
#include "cmLinkedTree.h"
#include "cmAlgorithms.h"
class cmake;
class cmCommand;
@ -56,6 +57,8 @@ public:
Snapshot GetBuildsystemDirectoryParent() const;
Snapshot GetCallStackParent() const;
void InitializeFromParent();
cmState* GetState() const;
Directory GetDirectory() const;
@ -87,6 +90,32 @@ public:
void SetRelativePathTopSource(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:
void ComputeRelativePathTopSource();
void ComputeRelativePathTopBinary();