summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-05-24 09:50:55 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-27 13:18:32 (GMT)
commit3b880a07417a0211001b8dfa721ec220e6d8d2e3 (patch)
tree47116544531b097088a6c4d233d6688d035e292e
parente12afe766ee9083637ac819ec69a7b4512c39718 (diff)
downloadCMake-3b880a07417a0211001b8dfa721ec220e6d8d2e3.zip
CMake-3b880a07417a0211001b8dfa721ec220e6d8d2e3.tar.gz
CMake-3b880a07417a0211001b8dfa721ec220e6d8d2e3.tar.bz2
cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
Refactor the local generator creation API to accept a cmState::Snapshot. Adjust MakeLocalGenerator to use the 'current' snapshot in cases where there is no parent. Create the snapshot for subdirectories in cmMakefile::AddSubdirectory. This means that snapshots are now created at the point of extending the tree, as appropriate, and independently of the cmLocalGenerator and cmMakefile they represent the state for.
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx4
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h3
-rw-r--r--Source/cmGlobalGenerator.cxx17
-rw-r--r--Source/cmGlobalGenerator.h8
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx5
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h3
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx5
-rw-r--r--Source/cmGlobalNinjaGenerator.h3
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx5
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h3
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmGlobalXCodeGenerator.h3
-rw-r--r--Source/cmLocalGenerator.cxx11
-rw-r--r--Source/cmLocalGenerator.h3
-rw-r--r--Source/cmLocalGhsMultiGenerator.cxx5
-rw-r--r--Source/cmLocalGhsMultiGenerator.h3
-rw-r--r--Source/cmLocalNinjaGenerator.cxx5
-rw-r--r--Source/cmLocalNinjaGenerator.h3
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h3
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx5
-rw-r--r--Source/cmLocalVisualStudio10Generator.h3
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx5
-rw-r--r--Source/cmLocalVisualStudio6Generator.h3
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx5
-rw-r--r--Source/cmLocalVisualStudio7Generator.h3
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx5
-rw-r--r--Source/cmLocalVisualStudioGenerator.h3
-rw-r--r--Source/cmLocalXCodeGenerator.cxx5
-rw-r--r--Source/cmLocalXCodeGenerator.h3
-rw-r--r--Source/cmMakefile.cxx5
-rw-r--r--Source/cmState.cxx4
38 files changed, 111 insertions, 64 deletions
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 7d05726..87665a0 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -44,10 +44,10 @@ void cmGlobalBorlandMakefileGenerator
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(
- cmLocalGenerator* parent)
+ cmLocalGenerator* parent, cmState::Snapshot snapshot)
{
cmLocalUnixMakefileGenerator3* lg =
- new cmLocalUnixMakefileGenerator3(this, parent);
+ new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
lg->SetMakefileVariableSize(32);
lg->SetMakeCommandEscapeTargetTwice(true);
lg->SetBorlandMakeCurlyHack(true);
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index eac297e..2ec510d 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -36,7 +36,8 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 7cb5724..cd05c54 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1884,15 +1884,22 @@ void cmGlobalGenerator::EnableInstallTarget()
}
cmLocalGenerator *
-cmGlobalGenerator::MakeLocalGenerator(cmLocalGenerator *parent)
+cmGlobalGenerator::MakeLocalGenerator(cmState::Snapshot snapshot,
+ cmLocalGenerator *parent)
{
- return this->CreateLocalGenerator(parent);
+ if (!snapshot.IsValid())
+ {
+ snapshot = this->CMakeInstance->GetCurrentSnapshot();
+ }
+
+ return this->CreateLocalGenerator(parent, snapshot);
}
-cmLocalGenerator *
-cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent)
+cmLocalGenerator*
+cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalGenerator(this, parent);
+ return new cmLocalGenerator(this, parent, snapshot);
}
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 98f87ed..979e971 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -21,6 +21,7 @@
#include "cmExportSetMap.h" // For cmExportSetMap
#include "cmGeneratorTarget.h"
#include "cmGeneratorExpression.h"
+#include "cmState.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmFileLockPool.h"
@@ -56,7 +57,9 @@ public:
cmGlobalGenerator(cmake* cm);
virtual ~cmGlobalGenerator();
- cmLocalGenerator* MakeLocalGenerator(cmLocalGenerator* parent = 0);
+ cmLocalGenerator* MakeLocalGenerator(
+ cmState::Snapshot snapshot = cmState::Snapshot(),
+ cmLocalGenerator* parent = 0);
///! Get the name for this generator
virtual std::string GetName() const { return "Generic"; }
@@ -441,7 +444,8 @@ protected:
private:
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
cmMakefile* TryCompileOuterMakefile;
float FirstTimeProgress;
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 2bb0617..f764418 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -33,9 +33,10 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
}
cmLocalGenerator *
-cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
+cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalGhsMultiGenerator(this, parent);
+ return new cmLocalGhsMultiGenerator(this, parent, snapshot);
}
void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry)
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 8b7ecf8..f1a3ed7 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -31,7 +31,8 @@ public:
{ return new cmGlobalGeneratorSimpleFactory<cmGlobalGhsMultiGenerator>(); }
///! create the correct local generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
/// @return the name of this generator.
static std::string GetActualName() { return "Green Hills MULTI"; }
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 2c5896c..10828e2 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -529,9 +529,10 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
// Virtual public methods.
cmLocalGenerator*
-cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
+cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalNinjaGenerator(this, parent);
+ return new cmLocalNinjaGenerator(this, parent, snapshot);
}
void cmGlobalNinjaGenerator
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 88b7067..ffd1cdc 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -170,7 +170,8 @@ public:
virtual ~cmGlobalNinjaGenerator() { }
/// Overloaded methods. @see cmGlobalGenerator::CreateLocalGenerator()
- virtual cmLocalGenerator* CreateLocalGenerator(cmLocalGenerator* parent = 0);
+ virtual cmLocalGenerator* CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
/// Overloaded methods. @see cmGlobalGenerator::GetName().
virtual std::string GetName() const {
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 372e87a..4fe52dd 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -60,9 +60,10 @@ void cmGlobalUnixMakefileGenerator3
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
-cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent)
+cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalUnixMakefileGenerator3(this, parent);
+ return new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 686a4c9..a639ff0 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -68,7 +68,8 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator3
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 0835707..4e8ada4 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -307,9 +307,10 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
-cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent)
+cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalVisualStudio10Generator(this, parent);
+ return new cmLocalVisualStudio10Generator(this, parent, snapshot);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 9faa603..74d5022 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -46,7 +46,8 @@ public:
);
///! create the correct local generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index f420e4a..632141a 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -173,9 +173,10 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
-cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent)
+cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalVisualStudio6Generator(this, parent);
+ return new cmLocalVisualStudio6Generator(this, parent, snapshot);
}
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 2e61501..2460158 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -39,7 +39,8 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 336328c..4dd54d0 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -279,10 +279,11 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
-cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent)
+cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
cmLocalVisualStudio7Generator *lg =
- new cmLocalVisualStudio7Generator(this, parent);
+ new cmLocalVisualStudio7Generator(this, parent, snapshot);
return lg;
}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index cbd753b..c98d269 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -43,7 +43,8 @@ public:
std::string const& GetPlatformName() const;
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 302784d..7464e90 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -371,9 +371,10 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
//----------------------------------------------------------------------------
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
-cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent)
+cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalXCodeGenerator(this, parent);
+ return new cmLocalXCodeGenerator(this, parent, snapshot);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 42b6697..c36e4af 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -41,7 +41,8 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent = 0);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d00b677..7d8596e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -44,19 +44,16 @@
#endif
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : StateSnapshot(snapshot)
{
+ assert(snapshot.IsValid());
this->GlobalGenerator = gg;
this->Parent = parent;
if (parent)
{
parent->AddChild(this);
- this->StateSnapshot =
- this->GetState()->CreateSnapshot(parent->StateSnapshot);
- }
- else
- {
- this->StateSnapshot = gg->GetCMakeInstance()->GetCurrentSnapshot();
}
this->Makefile = new cmMakefile(this);
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 3fca225..44c9586 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -34,7 +34,8 @@ class cmCustomCommandGenerator;
class cmLocalGenerator
{
public:
- cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
+ cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalGenerator();
/// @return whether we are processing the top CMakeLists.txt file.
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index 025b464..870b9b9 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -17,8 +17,9 @@
#include "cmGeneratedFileStream.h"
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent)
- : cmLocalGenerator(gg, parent)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : cmLocalGenerator(gg, parent, snapshot)
{
}
diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h
index 3157f11..f52ef39 100644
--- a/Source/cmLocalGhsMultiGenerator.h
+++ b/Source/cmLocalGhsMultiGenerator.h
@@ -25,7 +25,8 @@ class cmGeneratedFileStream;
class cmLocalGhsMultiGenerator : public cmLocalGenerator
{
public:
- cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
+ cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalGhsMultiGenerator();
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index bcae486..c08c91f 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -23,8 +23,9 @@
#include <assert.h>
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent)
- : cmLocalGenerator(gg, parent)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : cmLocalGenerator(gg, parent, snapshot)
, ConfigName("")
, HomeRelativeOutputPath("")
{
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 08b10e6..7ae97de 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -31,7 +31,8 @@ class cmake;
class cmLocalNinjaGenerator : public cmLocalGenerator
{
public:
- cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
+ cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalNinjaGenerator();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index b68dc51..3eea59b 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -80,8 +80,9 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
//----------------------------------------------------------------------------
cmLocalUnixMakefileGenerator3::
-cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent)
- : cmLocalGenerator(gg, parent)
+cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : cmLocalGenerator(gg, parent, snapshot)
{
this->MakefileVariableSize = 0;
this->ColorMakefile = false;
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 0b056ff..988d660 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -35,7 +35,8 @@ class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator
{
public:
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
- cmLocalGenerator* parent);
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalUnixMakefileGenerator3();
/**
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 37b722a..ad6a020 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -63,8 +63,9 @@ class cmVS10XMLParser : public cmXMLParser
//----------------------------------------------------------------------------
cmLocalVisualStudio10Generator
::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent):
- cmLocalVisualStudio7Generator(gg, parent)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot):
+ cmLocalVisualStudio7Generator(gg, parent, snapshot)
{
}
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index afd52b9..c588aaf 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -26,7 +26,8 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
public:
///! Set cache only and recurse to false by default.
cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent);
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudio10Generator();
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 7afb53a..ad34857 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -25,8 +25,9 @@
cmLocalVisualStudio6Generator
::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent):
- cmLocalVisualStudioGenerator(gg, parent)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot):
+ cmLocalVisualStudioGenerator(gg, parent, snapshot)
{
}
diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h
index a6e0b3d..8f4d521 100644
--- a/Source/cmLocalVisualStudio6Generator.h
+++ b/Source/cmLocalVisualStudio6Generator.h
@@ -30,7 +30,8 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator
public:
///! Set cache only and recurse to false by default.
cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent);
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudio6Generator();
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index d2fb970..9c031cf 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -56,8 +56,9 @@ static void cmConvertToWindowsSlash(std::string& s)
//----------------------------------------------------------------------------
cmLocalVisualStudio7Generator
::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent):
- cmLocalVisualStudioGenerator(gg, parent)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot):
+ cmLocalVisualStudioGenerator(gg, parent, snapshot)
{
this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
}
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 59c2144..43f3af9 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -36,7 +36,8 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
public:
///! Set cache only and recurse to false by default.
cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent);
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudio7Generator();
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index f472bba..ca72939 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -20,8 +20,9 @@
//----------------------------------------------------------------------------
cmLocalVisualStudioGenerator
::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent)
- : cmLocalGenerator(gg, parent)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : cmLocalGenerator(gg, parent, snapshot)
{
}
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index df7d20c..d414651 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -32,7 +32,8 @@ class cmLocalVisualStudioGenerator : public cmLocalGenerator
{
public:
cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent);
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudioGenerator();
/** Construct a script from the given list of command lines. */
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index a957c27..804dd7d 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -16,8 +16,9 @@
//----------------------------------------------------------------------------
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent)
- : cmLocalGenerator(gg, parent)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : cmLocalGenerator(gg, parent, snapshot)
{
// the global generator does this, so do not
// put these flags into the language flags
diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h
index 54bc6df..26fff9c 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -24,7 +24,8 @@ class cmLocalXCodeGenerator : public cmLocalGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent);
+ cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalXCodeGenerator();
virtual std::string GetTargetDirectory(cmTarget const& target) const;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3e8ae85..1d05873 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1625,9 +1625,12 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
return;
}
+ cmState::Snapshot newSnapshot = this->GetState()
+ ->CreateSnapshot(this->StateSnapshot);
+
// create a new local generator and set its parent
cmLocalGenerator *lg2 = this->GetGlobalGenerator()
- ->MakeLocalGenerator(this->LocalGenerator);
+ ->MakeLocalGenerator(newSnapshot, this->LocalGenerator);
this->GetGlobalGenerator()->AddLocalGenerator(lg2);
// set the subdirs start dirs
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 9ecd061..58885d3 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -661,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);