summaryrefslogtreecommitdiffstats
path: root/Source/cmState.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r--Source/cmState.cxx117
1 files changed, 100 insertions, 17 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 4965ae3..58885d3 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -20,9 +20,14 @@
cmState::cmState(cmake* cm)
: CMakeInstance(cm),
- IsInTryCompile(false)
+ IsInTryCompile(false),
+ WindowsShell(false),
+ WindowsVSIDE(false),
+ WatcomWMake(false),
+ MinGWMake(false),
+ NMake(false),
+ MSYSShell(false)
{
- this->Initialize();
}
cmState::~cmState()
@@ -190,19 +195,35 @@ void cmState::RemoveCacheEntryProperty(std::string const& key,
->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0);
}
-void cmState::Initialize()
+void cmState::Reset()
{
this->GlobalProperties.clear();
this->PropertyDefinitions.clear();
- this->Locations.clear();
- this->OutputLocations.clear();
- this->ParentPositions.clear();
- this->CurrentSourceDirectoryComponents.clear();
- this->CurrentBinaryDirectoryComponents.clear();
- this->RelativePathTopSource.clear();
- this->RelativePathTopBinary.clear();
-
- this->CreateSnapshot(Snapshot());
+
+ assert(this->Locations.size() > 0);
+ assert(this->OutputLocations.size() > 0);
+ assert(this->ParentPositions.size() > 0);
+ assert(this->CurrentSourceDirectoryComponents.size() > 0);
+ assert(this->CurrentBinaryDirectoryComponents.size() > 0);
+ assert(this->RelativePathTopSource.size() > 0);
+ assert(this->RelativePathTopBinary.size() > 0);
+
+ this->Locations.erase(this->Locations.begin() + 1, this->Locations.end());
+ this->OutputLocations.erase(this->OutputLocations.begin() + 1,
+ this->OutputLocations.end());
+ this->ParentPositions.erase(this->ParentPositions.begin() + 1,
+ this->ParentPositions.end());
+ this->CurrentSourceDirectoryComponents.erase(
+ this->CurrentSourceDirectoryComponents.begin() + 1,
+ this->CurrentSourceDirectoryComponents.end());
+ this->CurrentBinaryDirectoryComponents.erase(
+ this->CurrentBinaryDirectoryComponents.begin() + 1,
+ this->CurrentBinaryDirectoryComponents.end());
+ this->RelativePathTopSource.erase(this->RelativePathTopSource.begin() + 1,
+ this->RelativePathTopSource.end());
+ this->RelativePathTopBinary.erase(this->RelativePathTopBinary.begin() + 1,
+ this->RelativePathTopBinary.end());
+
this->DefineProperty
("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
"", "", true);
@@ -488,6 +509,66 @@ void cmState::SetBinaryDirectory(std::string const& binaryDirectory)
this->BinaryDirectoryComponents);
}
+void cmState::SetWindowsShell(bool windowsShell)
+{
+ this->WindowsShell = windowsShell;
+}
+
+bool cmState::UseWindowsShell() const
+{
+ return this->WindowsShell;
+}
+
+void cmState::SetWindowsVSIDE(bool windowsVSIDE)
+{
+ this->WindowsVSIDE = windowsVSIDE;
+}
+
+bool cmState::UseWindowsVSIDE() const
+{
+ return this->WindowsVSIDE;
+}
+
+void cmState::SetWatcomWMake(bool watcomWMake)
+{
+ this->WatcomWMake = watcomWMake;
+}
+
+bool cmState::UseWatcomWMake() const
+{
+ return this->WatcomWMake;
+}
+
+void cmState::SetMinGWMake(bool minGWMake)
+{
+ this->MinGWMake = minGWMake;
+}
+
+bool cmState::UseMinGWMake() const
+{
+ return this->MinGWMake;
+}
+
+void cmState::SetNMake(bool nMake)
+{
+ this->NMake = nMake;
+}
+
+bool cmState::UseNMake() const
+{
+ return this->NMake;
+}
+
+void cmState::SetMSYSShell(bool mSYSShell)
+{
+ this->MSYSShell = mSYSShell;
+}
+
+bool cmState::UseMSYSShell() const
+{
+ return this->MSYSShell;
+}
+
const char* cmState::GetBinaryDirectory() const
{
return this->BinaryDirectory.c_str();
@@ -580,6 +661,10 @@ void cmState::Snapshot::ComputeRelativePathTopBinary()
cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot)
{
+ if (!originSnapshot.IsValid())
+ {
+ originSnapshot.State = this;
+ }
PositionType pos = this->ParentPositions.size();
this->ParentPositions.push_back(originSnapshot.Position);
this->Locations.resize(this->Locations.size() + 1);
@@ -607,6 +692,7 @@ const char* cmState::Snapshot::GetCurrentSourceDirectory() const
void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir)
{
+ assert(this->State);
assert(this->State->Locations.size() > this->Position);
this->State->Locations[this->Position] = dir;
cmSystemTools::ConvertToUnixSlashes(
@@ -681,15 +767,12 @@ bool cmState::Snapshot::IsValid() const
cmState::Snapshot cmState::Snapshot::GetParent() const
{
Snapshot snapshot;
- if (!this->State)
+ if (!this->State || this->Position == 0)
{
return snapshot;
}
PositionType parentPos = this->State->ParentPositions[this->Position];
- if (parentPos > 0)
- {
- snapshot = Snapshot(this->State, parentPos);
- }
+ snapshot = Snapshot(this->State, parentPos);
return snapshot;
}