summaryrefslogtreecommitdiffstats
path: root/Source/cmState.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-13 19:52:33 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-13 22:16:07 (GMT)
commit2c219bafc045dfdf49529b8ad141fed3dbb4d8e9 (patch)
tree88438e304e55c8b3540f23940e95e3019326b3fe /Source/cmState.cxx
parent84e0776e77e625ab43c1a5b2031a06a035ae0210 (diff)
downloadCMake-2c219bafc045dfdf49529b8ad141fed3dbb4d8e9.zip
CMake-2c219bafc045dfdf49529b8ad141fed3dbb4d8e9.tar.gz
CMake-2c219bafc045dfdf49529b8ad141fed3dbb4d8e9.tar.bz2
cmState: Initialize top level source directories immediately.
Don't leave this as cmMakefile responsibility.
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r--Source/cmState.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 72c7330..9de58d8 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -306,11 +306,21 @@ cmState::Snapshot cmState::Reset()
pos->PolicyScope = this->PolicyStack.Root();
assert(pos->Policies.IsValid());
assert(pos->PolicyRoot.IsValid());
+
+ {
+ std::string srcDir =
+ cmDefinitions::Get("CMAKE_SOURCE_DIR", pos->Vars, pos->Root);
+ std::string binDir =
+ cmDefinitions::Get("CMAKE_BINARY_DIR", pos->Vars, pos->Root);
this->VarTree.Clear();
pos->Vars = this->VarTree.Extend(this->VarTree.Root());
pos->Parent = this->VarTree.Root();
pos->Root = this->VarTree.Root();
+ pos->Vars->Set("CMAKE_SOURCE_DIR", srcDir.c_str());
+ pos->Vars->Set("CMAKE_BINARY_DIR", binDir.c_str());
+ }
+
this->DefineProperty
("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
"", "", true);
@@ -838,6 +848,7 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
cmState::Snapshot snapshot = cmState::Snapshot(this, pos);
originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot);
snapshot.InitializeFromParent();
+ snapshot.SetDirectoryDefinitions();
return snapshot;
}
@@ -1318,6 +1329,14 @@ void InitializeContentFromParent(T& parentContent,
contentEndPosition = thisContent.size();
}
+void cmState::Snapshot::SetDirectoryDefinitions()
+{
+ this->SetDefinition("CMAKE_SOURCE_DIR",
+ this->State->GetSourceDirectory());
+ this->SetDefinition("CMAKE_BINARY_DIR",
+ this->State->GetBinaryDirectory());
+}
+
void cmState::Snapshot::InitializeFromParent()
{
PositionType parent = this->Position->DirectoryParent;