summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-12 19:34:06 +0200
committerStephen Kelly <steveire@gmail.com>2015-10-14 00:34:11 +0200
commit2bf7de167f0b72b07c6246679c964d83cdc47d45 (patch)
treee2a9b990f9134adeeac21b58e61c6e103a1eb9a6 /Source
parent0aa34de5493732d219dd3f58634222677bd19e22 (diff)
downloadcmake-2bf7de167f0b72b07c6246679c964d83cdc47d45.tar.gz
Subdirs: Initialize from parent before configuring.
Add new API for the subdirs command to cmState. This fixes a regression introduced in commit f716460e (cmMakefile: Move invokation to initialize snapshot., 2015-10-06).
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx1
-rw-r--r--Source/cmState.cxx14
-rw-r--r--Source/cmState.h2
3 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3f941259ab..ce95b2c6cc 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1647,6 +1647,7 @@ void cmMakefile::Configure()
std::vector<cmMakefile*>::iterator sdi = subdirs.begin();
for (; sdi != subdirs.end(); ++sdi)
{
+ (*sdi)->StateSnapshot.InitializeFromParent_ForSubdirsCommand();
this->ConfigureSubDirectory(*sdi);
}
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 01fd4e2004..825204c1e9 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -1447,6 +1447,20 @@ std::string cmState::Snapshot::GetProjectName() const
return this->Position->BuildSystemDirectory->ProjectName;
}
+void cmState::Snapshot::InitializeFromParent_ForSubdirsCommand()
+{
+ std::string currentSrcDir = this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR");
+ std::string currentBinDir = this->GetDefinition("CMAKE_CURRENT_BINARY_DIR");
+ this->InitializeFromParent();
+ this->SetDefinition("CMAKE_SOURCE_DIR",
+ this->State->GetSourceDirectory());
+ this->SetDefinition("CMAKE_BINARY_DIR",
+ this->State->GetBinaryDirectory());
+
+ this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", currentSrcDir.c_str());
+ this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir.c_str());
+}
+
cmState::Directory::Directory(
cmLinkedTree<BuildsystemDirectoryStateType>::iterator iter,
const cmState::Snapshot& snapshot)
diff --git a/Source/cmState.h b/Source/cmState.h
index 3e8a4654af..f2c0c6fb06 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -90,6 +90,8 @@ public:
void SetProjectName(std::string const& name);
std::string GetProjectName() const;
+ void InitializeFromParent_ForSubdirsCommand();
+
struct StrictWeakOrder
{
bool operator()(const cmState::Snapshot& lhs,