Merge topic 'inject-state-snapshot'

3b880a07 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor.
e12afe76 cmState: Host some state from the cmGlobalGenerator.
c7b79aa1 cmGlobalGenerator: Require a cmake instance in ctor.
01e1cd5c cmState: Move snapshot creation to the cmake instance.
This commit is contained in:
Brad King 2015-05-27 09:23:01 -04:00 committed by CMake Topic Stage
commit c12fc3573b
74 changed files with 389 additions and 273 deletions

View File

@ -715,8 +715,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cm.AddCMakePaths(); cm.AddCMakePaths();
cm.SetProgressCallback(cmCPackGeneratorProgress, this); cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg; cmGlobalGenerator gg(&cm);
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile(); cmMakefile *mf = lg->GetMakefile();
std::string realInstallDirectory = tempInstallDirectory; std::string realInstallDirectory = tempInstallDirectory;

View File

@ -201,8 +201,7 @@ int main (int argc, char const* const* argv)
cminst.SetHomeDirectory(""); cminst.SetHomeDirectory("");
cminst.SetHomeOutputDirectory(""); cminst.SetHomeOutputDirectory("");
cminst.GetState()->RemoveUnscriptableCommands(); cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg; cmGlobalGenerator cmgg(&cminst);
cmgg.SetCMakeInstance(&cminst);
cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.MakeLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.MakeLocalGenerator());
cmMakefile* globalMF = cmlg->GetMakefile(); cmMakefile* globalMF = cmlg->GetMakefile();
#if defined(__CYGWIN__) #if defined(__CYGWIN__)

View File

@ -752,8 +752,7 @@ void cmCTestLaunch::LoadConfig()
cmake cm; cmake cm;
cm.SetHomeDirectory(""); cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg; cmGlobalGenerator gg(&cm);
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile* mf = lg->GetMakefile(); cmMakefile* mf = lg->GetMakefile();
std::string fname = this->LogDir; std::string fname = this->LogDir;

View File

@ -339,8 +339,7 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->SetHomeDirectory(""); this->CMake->SetHomeDirectory("");
this->CMake->SetHomeOutputDirectory(""); this->CMake->SetHomeOutputDirectory("");
this->CMake->AddCMakePaths(); this->CMake->AddCMakePaths();
this->GlobalGenerator = new cmGlobalGenerator; this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
this->GlobalGenerator->SetCMakeInstance(this->CMake);
this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator(); this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator();
this->Makefile = this->LocalGenerator->GetMakefile(); this->Makefile = this->LocalGenerator->GetMakefile();

View File

@ -1573,8 +1573,7 @@ void cmCTestTestHandler::GetListOfTests()
cmake cm; cmake cm;
cm.SetHomeDirectory(""); cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg; cmGlobalGenerator gg(&cm);
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile(); cmMakefile *mf = lg->GetMakefile();
mf->AddDefinition("CTEST_CONFIGURATION_TYPE", mf->AddDefinition("CTEST_CONFIGURATION_TYPE",

View File

@ -512,8 +512,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cmake cm; cmake cm;
cm.SetHomeDirectory(""); cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg; cmGlobalGenerator gg(&cm);
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile(); cmMakefile *mf = lg->GetMakefile();
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) ) if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )

View File

@ -14,14 +14,15 @@
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmake.h" #include "cmake.h"
cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator() cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
{ {
this->EmptyRuleHackDepends = "NUL"; this->EmptyRuleHackDepends = "NUL";
this->FindMakeProgramFile = "CMakeBorlandFindMake.cmake"; this->FindMakeProgramFile = "CMakeBorlandFindMake.cmake";
this->ForceUnixPaths = false; this->ForceUnixPaths = false;
this->ToolSupportsColor = true; this->ToolSupportsColor = true;
this->UseLinkScript = false; this->UseLinkScript = false;
this->WindowsShell = true; cm->GetState()->SetWindowsShell(true);
this->IncludeDirective = "!include"; this->IncludeDirective = "!include";
this->DefineWindowsNULL = true; this->DefineWindowsNULL = true;
this->PassMakeflags = true; this->PassMakeflags = true;
@ -43,10 +44,10 @@ void cmGlobalBorlandMakefileGenerator
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator( cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(
cmLocalGenerator* parent) cmLocalGenerator* parent, cmState::Snapshot snapshot)
{ {
cmLocalUnixMakefileGenerator3* lg = cmLocalUnixMakefileGenerator3* lg =
new cmLocalUnixMakefileGenerator3(this, parent); new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
lg->SetMakefileVariableSize(32); lg->SetMakefileVariableSize(32);
lg->SetMakeCommandEscapeTargetTwice(true); lg->SetMakeCommandEscapeTargetTwice(true);
lg->SetBorlandMakeCurlyHack(true); lg->SetBorlandMakeCurlyHack(true);

View File

@ -22,7 +22,7 @@
class cmGlobalBorlandMakefileGenerator : public cmGlobalUnixMakefileGenerator3 class cmGlobalBorlandMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{ {
public: public:
cmGlobalBorlandMakefileGenerator(); cmGlobalBorlandMakefileGenerator(cmake* cm);
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory return new cmGlobalGeneratorSimpleFactory
<cmGlobalBorlandMakefileGenerator>(); } <cmGlobalBorlandMakefileGenerator>(); }
@ -36,7 +36,8 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry); static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator ///! 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 * Try to determine system information such as shared library

View File

@ -48,7 +48,8 @@
#include <assert.h> #include <assert.h>
cmGlobalGenerator::cmGlobalGenerator() cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
: CMakeInstance(cm)
{ {
// By default the .SYMBOLIC dependency is not needed on symbolic rules. // By default the .SYMBOLIC dependency is not needed on symbolic rules.
this->NeedSymbolicMark = false; this->NeedSymbolicMark = false;
@ -71,13 +72,6 @@ cmGlobalGenerator::cmGlobalGenerator()
this->ExtraGenerator = 0; this->ExtraGenerator = 0;
this->CurrentLocalGenerator = 0; this->CurrentLocalGenerator = 0;
this->TryCompileOuterMakefile = 0; this->TryCompileOuterMakefile = 0;
this->WindowsShell = false;
this->WindowsVSIDE = false;
this->WatcomWMake = false;
this->MinGWMake = false;
this->NMake = false;
this->MSYSShell = false;
} }
cmGlobalGenerator::~cmGlobalGenerator() cmGlobalGenerator::~cmGlobalGenerator()
@ -1890,15 +1884,22 @@ void cmGlobalGenerator::EnableInstallTarget()
} }
cmLocalGenerator * 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 * cmLocalGenerator*
cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator *parent) cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
{ {
return new cmLocalGenerator(this, parent); return new cmLocalGenerator(this, parent, snapshot);
} }
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen, void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
@ -2141,12 +2142,6 @@ inline std::string removeQuotes(const std::string& s)
return s; return s;
} }
void cmGlobalGenerator::SetCMakeInstance(cmake* cm)
{
// Store a pointer to the cmake object instance.
this->CMakeInstance = cm;
}
void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
{ {
cmMakefile* mf = this->LocalGenerators[0]->GetMakefile(); cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();

View File

@ -21,6 +21,7 @@
#include "cmExportSetMap.h" // For cmExportSetMap #include "cmExportSetMap.h" // For cmExportSetMap
#include "cmGeneratorTarget.h" #include "cmGeneratorTarget.h"
#include "cmGeneratorExpression.h" #include "cmGeneratorExpression.h"
#include "cmState.h"
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmFileLockPool.h" # include "cmFileLockPool.h"
@ -53,10 +54,12 @@ class cmGlobalGenerator
{ {
public: public:
///! Free any memory allocated with the GlobalGenerator ///! Free any memory allocated with the GlobalGenerator
cmGlobalGenerator(); cmGlobalGenerator(cmake* cm);
virtual ~cmGlobalGenerator(); virtual ~cmGlobalGenerator();
cmLocalGenerator* MakeLocalGenerator(cmLocalGenerator* parent = 0); cmLocalGenerator* MakeLocalGenerator(
cmState::Snapshot snapshot = cmState::Snapshot(),
cmLocalGenerator* parent = 0);
///! Get the name for this generator ///! Get the name for this generator
virtual std::string GetName() const { return "Generic"; } virtual std::string GetName() const { return "Generic"; }
@ -158,9 +161,6 @@ public:
const std::string& native, const std::string& native,
bool ignoreErrors); bool ignoreErrors);
///! Set the CMake instance
void SetCMakeInstance(cmake *cm);
///! Get the CMake instance ///! Get the CMake instance
cmake *GetCMakeInstance() const { return this->CMakeInstance; } cmake *GetCMakeInstance() const { return this->CMakeInstance; }
@ -358,13 +358,6 @@ public:
#endif #endif
std::string MakeSilentFlag; std::string MakeSilentFlag;
bool WindowsShell;
bool WindowsVSIDE;
bool WatcomWMake;
bool MinGWMake;
bool NMake;
bool MSYSShell;
protected: protected:
virtual void Generate(); virtual void Generate();
@ -451,7 +444,8 @@ protected:
private: private:
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent); virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
cmMakefile* TryCompileOuterMakefile; cmMakefile* TryCompileOuterMakefile;
float FirstTimeProgress; float FirstTimeProgress;

View File

@ -15,6 +15,7 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
class cmake;
class cmGlobalGenerator; class cmGlobalGenerator;
struct cmDocumentationEntry; struct cmDocumentationEntry;
@ -30,7 +31,7 @@ public:
/** Create a GlobalGenerator */ /** Create a GlobalGenerator */
virtual cmGlobalGenerator* CreateGlobalGenerator( virtual cmGlobalGenerator* CreateGlobalGenerator(
const std::string& n) const = 0; const std::string& n, cmake* cm) const = 0;
/** Get the documentation entry for this factory */ /** Get the documentation entry for this factory */
virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0; virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
@ -44,10 +45,10 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
{ {
public: public:
/** Create a GlobalGenerator */ /** Create a GlobalGenerator */
virtual cmGlobalGenerator* CreateGlobalGenerator( virtual cmGlobalGenerator*
const std::string& name) const { CreateGlobalGenerator(const std::string& name, cmake* cm) const {
if (name != T::GetActualName()) return 0; if (name != T::GetActualName()) return 0;
return new T; } return new T(cm); }
/** Get the documentation entry for this factory */ /** Get the documentation entry for this factory */
virtual void GetDocumentation(cmDocumentationEntry& entry) const { virtual void GetDocumentation(cmDocumentationEntry& entry) const {

View File

@ -21,8 +21,8 @@
const char *cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; const char *cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
const char *cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild"; const char *cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild";
cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator() cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
: OSDirRelative(false) : cmGlobalGenerator(cm), OSDirRelative(false)
{ {
this->GhsBuildCommandInitialized = false; this->GhsBuildCommandInitialized = false;
} }
@ -33,9 +33,10 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
} }
cmLocalGenerator * 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) void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry)

View File

@ -24,14 +24,15 @@ public:
/// The default name of GHS MULTI's build file. Typically: monolith.gpj. /// The default name of GHS MULTI's build file. Typically: monolith.gpj.
static const char *FILE_EXTENSION; static const char *FILE_EXTENSION;
cmGlobalGhsMultiGenerator(); cmGlobalGhsMultiGenerator(cmake* cm);
~cmGlobalGhsMultiGenerator(); ~cmGlobalGhsMultiGenerator();
static cmGlobalGeneratorFactory *NewFactory() static cmGlobalGeneratorFactory *NewFactory()
{ return new cmGlobalGeneratorSimpleFactory<cmGlobalGhsMultiGenerator>(); } { return new cmGlobalGeneratorSimpleFactory<cmGlobalGhsMultiGenerator>(); }
///! create the correct local generator ///! 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. /// @return the name of this generator.
static std::string GetActualName() { return "Green Hills MULTI"; } static std::string GetActualName() { return "Green Hills MULTI"; }

View File

@ -13,14 +13,15 @@
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator() cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
{ {
this->FindMakeProgramFile = "CMakeJOMFindMake.cmake"; this->FindMakeProgramFile = "CMakeJOMFindMake.cmake";
this->ForceUnixPaths = false; this->ForceUnixPaths = false;
this->ToolSupportsColor = true; this->ToolSupportsColor = true;
this->UseLinkScript = false; this->UseLinkScript = false;
this->WindowsShell = true; cm->GetState()->SetWindowsShell(true);
this->NMake = true; cm->GetState()->SetNMake(true);
this->DefineWindowsNULL = true; this->DefineWindowsNULL = true;
this->PassMakeflags = true; this->PassMakeflags = true;
this->UnixCD = false; this->UnixCD = false;

View File

@ -22,7 +22,7 @@
class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3 class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{ {
public: public:
cmGlobalJOMMakefileGenerator(); cmGlobalJOMMakefileGenerator(cmake* cm);
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory return new cmGlobalGeneratorSimpleFactory
<cmGlobalJOMMakefileGenerator>(); } <cmGlobalJOMMakefileGenerator>(); }

View File

@ -15,13 +15,14 @@
#include "cmake.h" #include "cmake.h"
#include <cmsys/FStream.hxx> #include <cmsys/FStream.hxx>
cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator() cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
{ {
this->FindMakeProgramFile = "CMakeMSYSFindMake.cmake"; this->FindMakeProgramFile = "CMakeMSYSFindMake.cmake";
this->ForceUnixPaths = true; this->ForceUnixPaths = true;
this->ToolSupportsColor = true; this->ToolSupportsColor = true;
this->UseLinkScript = false; this->UseLinkScript = false;
this->MSYSShell = true; cm->GetState()->SetMSYSShell(true);
} }
std::string std::string

View File

@ -22,7 +22,7 @@
class cmGlobalMSYSMakefileGenerator : public cmGlobalUnixMakefileGenerator3 class cmGlobalMSYSMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{ {
public: public:
cmGlobalMSYSMakefileGenerator(); cmGlobalMSYSMakefileGenerator(cmake* cm);
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory return new cmGlobalGeneratorSimpleFactory
<cmGlobalMSYSMakefileGenerator>(); } <cmGlobalMSYSMakefileGenerator>(); }

View File

@ -13,14 +13,15 @@
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator() cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
{ {
this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake"; this->FindMakeProgramFile = "CMakeMinGWFindMake.cmake";
this->ForceUnixPaths = true; this->ForceUnixPaths = true;
this->ToolSupportsColor = true; this->ToolSupportsColor = true;
this->UseLinkScript = true; this->UseLinkScript = true;
this->WindowsShell = true; cm->GetState()->SetWindowsShell(true);
this->MinGWMake = true; cm->GetState()->SetMinGWMake(true);
} }
void cmGlobalMinGWMakefileGenerator void cmGlobalMinGWMakefileGenerator

View File

@ -22,7 +22,7 @@
class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3 class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{ {
public: public:
cmGlobalMinGWMakefileGenerator(); cmGlobalMinGWMakefileGenerator(cmake* cm);
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory return new cmGlobalGeneratorSimpleFactory
<cmGlobalMinGWMakefileGenerator>(); } <cmGlobalMinGWMakefileGenerator>(); }

View File

@ -13,14 +13,15 @@
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator() cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
{ {
this->FindMakeProgramFile = "CMakeNMakeFindMake.cmake"; this->FindMakeProgramFile = "CMakeNMakeFindMake.cmake";
this->ForceUnixPaths = false; this->ForceUnixPaths = false;
this->ToolSupportsColor = true; this->ToolSupportsColor = true;
this->UseLinkScript = false; this->UseLinkScript = false;
this->WindowsShell = true; cm->GetState()->SetWindowsShell(true);
this->NMake = true; cm->GetState()->SetNMake(true);
this->DefineWindowsNULL = true; this->DefineWindowsNULL = true;
this->PassMakeflags = true; this->PassMakeflags = true;
this->UnixCD = false; this->UnixCD = false;

View File

@ -22,7 +22,7 @@
class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3 class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3
{ {
public: public:
cmGlobalNMakeMakefileGenerator(); cmGlobalNMakeMakefileGenerator(cmake* cm);
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory return new cmGlobalGeneratorSimpleFactory
<cmGlobalNMakeMakefileGenerator>(); } <cmGlobalNMakeMakefileGenerator>(); }

View File

@ -504,8 +504,8 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os,
} }
cmGlobalNinjaGenerator::cmGlobalNinjaGenerator() cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
: cmGlobalGenerator() : cmGlobalGenerator(cm)
, BuildFileStream(0) , BuildFileStream(0)
, RulesFileStream(0) , RulesFileStream(0)
, CompileCommandsStream(0) , CompileCommandsStream(0)
@ -516,7 +516,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
, PolicyCMP0058(cmPolicies::WARN) , PolicyCMP0058(cmPolicies::WARN)
{ {
#ifdef _WIN32 #ifdef _WIN32
this->WindowsShell = true; cm->GetState()->SetWindowsShell(true);
#endif #endif
// // Ninja is not ported to non-Unix OS yet. // // Ninja is not ported to non-Unix OS yet.
// this->ForceUnixPaths = true; // this->ForceUnixPaths = true;
@ -528,9 +528,10 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
// Virtual public methods. // Virtual public methods.
cmLocalGenerator* 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 void cmGlobalNinjaGenerator

View File

@ -160,8 +160,7 @@ public:
bool IsGCCOnWindows() const { return UsingGCCOnWindows; } bool IsGCCOnWindows() const { return UsingGCCOnWindows; }
public: public:
/// Default constructor. cmGlobalNinjaGenerator(cmake* cm);
cmGlobalNinjaGenerator();
/// Convenience method for creating an instance of this class. /// Convenience method for creating an instance of this class.
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
@ -171,7 +170,8 @@ public:
virtual ~cmGlobalNinjaGenerator() { } virtual ~cmGlobalNinjaGenerator() { }
/// Overloaded methods. @see cmGlobalGenerator::CreateLocalGenerator() /// Overloaded methods. @see cmGlobalGenerator::CreateLocalGenerator()
virtual cmLocalGenerator* CreateLocalGenerator(cmLocalGenerator* parent = 0); virtual cmLocalGenerator* CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot);
/// Overloaded methods. @see cmGlobalGenerator::GetName(). /// Overloaded methods. @see cmGlobalGenerator::GetName().
virtual std::string GetName() const { virtual std::string GetName() const {

View File

@ -20,7 +20,8 @@
#include "cmGeneratorTarget.h" #include "cmGeneratorTarget.h"
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm)
: cmGlobalGenerator(cm)
{ {
// This type of makefile always requires unix style paths // This type of makefile always requires unix style paths
this->ForceUnixPaths = true; this->ForceUnixPaths = true;
@ -59,9 +60,10 @@ void cmGlobalUnixMakefileGenerator3
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
cmLocalGenerator * cmLocalGenerator *
cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent) cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
{ {
return new cmLocalUnixMakefileGenerator3(this, parent); return new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -54,7 +54,7 @@ class cmLocalUnixMakefileGenerator3;
class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator
{ {
public: public:
cmGlobalUnixMakefileGenerator3(); cmGlobalUnixMakefileGenerator3(cmake* cm);
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory return new cmGlobalGeneratorSimpleFactory
<cmGlobalUnixMakefileGenerator3>(); } <cmGlobalUnixMakefileGenerator3>(); }
@ -68,7 +68,8 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry); static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator3 ///! 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 * Try to determine system information such as shared library

View File

@ -42,8 +42,8 @@ class cmGlobalVisualStudio10Generator::Factory
: public cmGlobalGeneratorFactory : public cmGlobalGeneratorFactory
{ {
public: public:
virtual cmGlobalGenerator* CreateGlobalGenerator( virtual cmGlobalGenerator*
const std::string& name) const CreateGlobalGenerator(const std::string& name, cmake* cm) const
{ {
std::string genName; std::string genName;
const char* p = cmVS10GenName(name, genName); const char* p = cmVS10GenName(name, genName);
@ -51,20 +51,17 @@ public:
{ return 0; } { return 0; }
if(!*p) if(!*p)
{ {
return new cmGlobalVisualStudio10Generator( return new cmGlobalVisualStudio10Generator(cm, genName, "");
genName, "");
} }
if(*p++ != ' ') if(*p++ != ' ')
{ return 0; } { return 0; }
if(strcmp(p, "Win64") == 0) if(strcmp(p, "Win64") == 0)
{ {
return new cmGlobalVisualStudio10Generator( return new cmGlobalVisualStudio10Generator(cm, genName, "x64");
genName, "x64");
} }
if(strcmp(p, "IA64") == 0) if(strcmp(p, "IA64") == 0)
{ {
return new cmGlobalVisualStudio10Generator( return new cmGlobalVisualStudio10Generator(cm, genName, "Itanium");
genName, "Itanium");
} }
return 0; return 0;
} }
@ -93,9 +90,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(cmake* cm,
const std::string& name, const std::string& platformName) const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio8Generator(name, platformName) : cmGlobalVisualStudio8Generator(cm, name, platformName)
{ {
std::string vc10Express; std::string vc10Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(
@ -310,9 +307,10 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
cmLocalGenerator * cmLocalGenerator *
cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent) cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
{ {
return new cmLocalVisualStudio10Generator(this, parent); return new cmLocalVisualStudio10Generator(this, parent, snapshot);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -24,7 +24,7 @@ class cmGlobalVisualStudio10Generator :
public cmGlobalVisualStudio8Generator public cmGlobalVisualStudio8Generator
{ {
public: public:
cmGlobalVisualStudio10Generator(const std::string& name, cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name,
const std::string& platformName); const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();
@ -46,7 +46,8 @@ public:
); );
///! create the correct local generator ///! 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 * Try to determine system information such as shared library

View File

@ -37,8 +37,8 @@ class cmGlobalVisualStudio11Generator::Factory
: public cmGlobalGeneratorFactory : public cmGlobalGeneratorFactory
{ {
public: public:
virtual cmGlobalGenerator* CreateGlobalGenerator( virtual cmGlobalGenerator*
const std::string& name) const CreateGlobalGenerator(const std::string& name, cmake* cm) const
{ {
std::string genName; std::string genName;
const char* p = cmVS11GenName(name, genName); const char* p = cmVS11GenName(name, genName);
@ -46,20 +46,17 @@ public:
{ return 0; } { return 0; }
if(!*p) if(!*p)
{ {
return new cmGlobalVisualStudio11Generator( return new cmGlobalVisualStudio11Generator(cm, genName, "");
genName, "");
} }
if(*p++ != ' ') if(*p++ != ' ')
{ return 0; } { return 0; }
if(strcmp(p, "Win64") == 0) if(strcmp(p, "Win64") == 0)
{ {
return new cmGlobalVisualStudio11Generator( return new cmGlobalVisualStudio11Generator(cm, genName, "x64");
genName, "x64");
} }
if(strcmp(p, "ARM") == 0) if(strcmp(p, "ARM") == 0)
{ {
return new cmGlobalVisualStudio11Generator( return new cmGlobalVisualStudio11Generator(cm, genName, "ARM");
genName, "ARM");
} }
std::set<std::string> installedSDKs = std::set<std::string> installedSDKs =
@ -71,7 +68,7 @@ public:
} }
cmGlobalVisualStudio11Generator* ret = cmGlobalVisualStudio11Generator* ret =
new cmGlobalVisualStudio11Generator(name, p); new cmGlobalVisualStudio11Generator(cm, name, p);
ret->WindowsCEVersion = "8.00"; ret->WindowsCEVersion = "8.00";
return ret; return ret;
} }
@ -108,9 +105,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(cmake* cm,
const std::string& name, const std::string& platformName) const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio10Generator(name, platformName) : cmGlobalVisualStudio10Generator(cm, name, platformName)
{ {
std::string vc11Express; std::string vc11Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(

View File

@ -20,7 +20,7 @@ class cmGlobalVisualStudio11Generator:
public cmGlobalVisualStudio10Generator public cmGlobalVisualStudio10Generator
{ {
public: public:
cmGlobalVisualStudio11Generator(const std::string& name, cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name,
const std::string& platformName); const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();

View File

@ -37,8 +37,8 @@ class cmGlobalVisualStudio12Generator::Factory
: public cmGlobalGeneratorFactory : public cmGlobalGeneratorFactory
{ {
public: public:
virtual cmGlobalGenerator* CreateGlobalGenerator( virtual cmGlobalGenerator*
const std::string& name) const CreateGlobalGenerator(const std::string& name, cmake* cm) const
{ {
std::string genName; std::string genName;
const char* p = cmVS12GenName(name, genName); const char* p = cmVS12GenName(name, genName);
@ -46,20 +46,17 @@ public:
{ return 0; } { return 0; }
if(!*p) if(!*p)
{ {
return new cmGlobalVisualStudio12Generator( return new cmGlobalVisualStudio12Generator(cm, genName, "");
genName, "");
} }
if(*p++ != ' ') if(*p++ != ' ')
{ return 0; } { return 0; }
if(strcmp(p, "Win64") == 0) if(strcmp(p, "Win64") == 0)
{ {
return new cmGlobalVisualStudio12Generator( return new cmGlobalVisualStudio12Generator(cm, genName, "x64");
genName, "x64");
} }
if(strcmp(p, "ARM") == 0) if(strcmp(p, "ARM") == 0)
{ {
return new cmGlobalVisualStudio12Generator( return new cmGlobalVisualStudio12Generator(cm, genName, "ARM");
genName, "ARM");
} }
return 0; return 0;
} }
@ -88,9 +85,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(cmake* cm,
const std::string& name, const std::string& platformName) const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio11Generator(name, platformName) : cmGlobalVisualStudio11Generator(cm, name, platformName)
{ {
std::string vc12Express; std::string vc12Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(

View File

@ -20,7 +20,7 @@ class cmGlobalVisualStudio12Generator:
public cmGlobalVisualStudio11Generator public cmGlobalVisualStudio11Generator
{ {
public: public:
cmGlobalVisualStudio12Generator(const std::string& name, cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name,
const std::string& platformName); const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();

View File

@ -37,8 +37,8 @@ class cmGlobalVisualStudio14Generator::Factory
: public cmGlobalGeneratorFactory : public cmGlobalGeneratorFactory
{ {
public: public:
virtual cmGlobalGenerator* CreateGlobalGenerator( virtual cmGlobalGenerator*
const std::string& name) const CreateGlobalGenerator(const std::string& name, cmake* cm) const
{ {
std::string genName; std::string genName;
const char* p = cmVS14GenName(name, genName); const char* p = cmVS14GenName(name, genName);
@ -46,20 +46,17 @@ public:
{ return 0; } { return 0; }
if(!*p) if(!*p)
{ {
return new cmGlobalVisualStudio14Generator( return new cmGlobalVisualStudio14Generator(cm, genName, "");
genName, "");
} }
if(*p++ != ' ') if(*p++ != ' ')
{ return 0; } { return 0; }
if(strcmp(p, "Win64") == 0) if(strcmp(p, "Win64") == 0)
{ {
return new cmGlobalVisualStudio14Generator( return new cmGlobalVisualStudio14Generator(cm, genName, "x64");
genName, "x64");
} }
if(strcmp(p, "ARM") == 0) if(strcmp(p, "ARM") == 0)
{ {
return new cmGlobalVisualStudio14Generator( return new cmGlobalVisualStudio14Generator(cm, genName, "ARM");
genName, "ARM");
} }
return 0; return 0;
} }
@ -88,9 +85,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(cmake* cm,
const std::string& name, const std::string& platformName) const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio12Generator(name, platformName) : cmGlobalVisualStudio12Generator(cm, name, platformName)
{ {
std::string vc14Express; std::string vc14Express;
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(

View File

@ -20,7 +20,7 @@ class cmGlobalVisualStudio14Generator:
public cmGlobalVisualStudio12Generator public cmGlobalVisualStudio12Generator
{ {
public: public:
cmGlobalVisualStudio14Generator(const std::string& name, cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name,
const std::string& platformName); const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();

View File

@ -31,7 +31,8 @@ std::string GetVS6TargetName(const std::string& targetName)
return name; return name;
} }
cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator() cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator(cmake* cm)
: cmGlobalVisualStudioGenerator(cm)
{ {
this->MSDevCommandInitialized = false; this->MSDevCommandInitialized = false;
this->Version = VS6; this->Version = VS6;
@ -172,9 +173,10 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
cmLocalGenerator * cmLocalGenerator *
cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent) cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
{ {
return new cmLocalVisualStudio6Generator(this, parent); return new cmLocalVisualStudio6Generator(this, parent, snapshot);
} }

View File

@ -25,7 +25,7 @@ class cmTarget;
class cmGlobalVisualStudio6Generator : public cmGlobalVisualStudioGenerator class cmGlobalVisualStudio6Generator : public cmGlobalVisualStudioGenerator
{ {
public: public:
cmGlobalVisualStudio6Generator(); cmGlobalVisualStudio6Generator(cmake* cm);
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory return new cmGlobalGeneratorSimpleFactory
<cmGlobalVisualStudio6Generator>(); } <cmGlobalVisualStudio6Generator>(); }
@ -39,7 +39,8 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry); static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator ///! 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 * Try to determine system information such as shared library

View File

@ -16,9 +16,9 @@
#include "cmake.h" #include "cmake.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator( cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(cmake* cm,
const std::string& platformName) const std::string& platformName)
: cmGlobalVisualStudio7Generator(platformName) : cmGlobalVisualStudio7Generator(cm, platformName)
{ {
this->ProjectConfigurationSectionName = "ProjectConfiguration"; this->ProjectConfigurationSectionName = "ProjectConfiguration";
this->Version = VS71; this->Version = VS71;

View File

@ -23,7 +23,8 @@
class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator
{ {
public: public:
cmGlobalVisualStudio71Generator(const std::string& platformName = ""); cmGlobalVisualStudio71Generator(cmake* cm,
const std::string& platformName = "");
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory return new cmGlobalGeneratorSimpleFactory
<cmGlobalVisualStudio71Generator>(); } <cmGlobalVisualStudio71Generator>(); }

View File

@ -44,8 +44,9 @@ static cmVS7FlagTable cmVS7ExtraFlagTable[] =
{0,0,0,0,0} {0,0,0,0,0}
}; };
cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(cmake *cm,
const std::string& platformName) const std::string& platformName)
: cmGlobalVisualStudioGenerator(cm)
{ {
this->IntelProjectVersion = 0; this->IntelProjectVersion = 0;
this->DevEnvCommandInitialized = false; this->DevEnvCommandInitialized = false;
@ -278,10 +279,11 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
cmLocalGenerator * cmLocalGenerator *
cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent) cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
{ {
cmLocalVisualStudio7Generator *lg = cmLocalVisualStudio7Generator *lg =
new cmLocalVisualStudio7Generator(this, parent); new cmLocalVisualStudio7Generator(this, parent, snapshot);
return lg; return lg;
} }

View File

@ -26,7 +26,8 @@ struct cmIDEFlagTable;
class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
{ {
public: public:
cmGlobalVisualStudio7Generator(const std::string& platformName = ""); cmGlobalVisualStudio7Generator(cmake* cm,
const std::string& platformName = "");
~cmGlobalVisualStudio7Generator(); ~cmGlobalVisualStudio7Generator();
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
@ -42,7 +43,8 @@ public:
std::string const& GetPlatformName() const; std::string const& GetPlatformName() const;
///! Create a local generator appropriate to this Global Generator ///! 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); virtual bool SetSystemName(std::string const& s, cmMakefile* mf);

View File

@ -24,8 +24,8 @@ class cmGlobalVisualStudio8Generator::Factory
: public cmGlobalGeneratorFactory : public cmGlobalGeneratorFactory
{ {
public: public:
virtual cmGlobalGenerator* CreateGlobalGenerator( virtual cmGlobalGenerator*
const std::string& name) const { CreateGlobalGenerator(const std::string& name, cmake* cm) const {
if(strncmp(name.c_str(), vs8generatorName, if(strncmp(name.c_str(), vs8generatorName,
sizeof(vs8generatorName) - 1) != 0) sizeof(vs8generatorName) - 1) != 0)
{ {
@ -35,8 +35,7 @@ public:
const char* p = name.c_str() + sizeof(vs8generatorName) - 1; const char* p = name.c_str() + sizeof(vs8generatorName) - 1;
if(p[0] == '\0') if(p[0] == '\0')
{ {
return new cmGlobalVisualStudio8Generator( return new cmGlobalVisualStudio8Generator(cm, name, "");
name, "");
} }
if(p[0] != ' ') if(p[0] != ' ')
@ -48,8 +47,7 @@ public:
if(!strcmp(p, "Win64")) if(!strcmp(p, "Win64"))
{ {
return new cmGlobalVisualStudio8Generator( return new cmGlobalVisualStudio8Generator(cm, name, "x64");
name, "x64");
} }
cmVisualStudioWCEPlatformParser parser(p); cmVisualStudioWCEPlatformParser parser(p);
@ -59,8 +57,8 @@ public:
return 0; return 0;
} }
cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator( cmGlobalVisualStudio8Generator* ret =
name, p); new cmGlobalVisualStudio8Generator(cm, name, p);
ret->WindowsCEVersion = parser.GetOSVersion(); ret->WindowsCEVersion = parser.GetOSVersion();
return ret; return ret;
} }
@ -95,9 +93,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(cmake* cm,
const std::string& name, const std::string& platformName) const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio71Generator(platformName) : cmGlobalVisualStudio71Generator(cm, platformName)
{ {
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
this->Name = name; this->Name = name;

View File

@ -23,7 +23,7 @@
class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator
{ {
public: public:
cmGlobalVisualStudio8Generator(const std::string& name, cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name,
const std::string& platformName); const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();

View File

@ -22,8 +22,8 @@ class cmGlobalVisualStudio9Generator::Factory
: public cmGlobalGeneratorFactory : public cmGlobalGeneratorFactory
{ {
public: public:
virtual cmGlobalGenerator* CreateGlobalGenerator( virtual cmGlobalGenerator*
const std::string& name) const { CreateGlobalGenerator(const std::string& name, cmake* cm) const {
if(strncmp(name.c_str(), vs9generatorName, if(strncmp(name.c_str(), vs9generatorName,
sizeof(vs9generatorName) - 1) != 0) sizeof(vs9generatorName) - 1) != 0)
{ {
@ -33,8 +33,7 @@ public:
const char* p = name.c_str() + sizeof(vs9generatorName) - 1; const char* p = name.c_str() + sizeof(vs9generatorName) - 1;
if(p[0] == '\0') if(p[0] == '\0')
{ {
return new cmGlobalVisualStudio9Generator( return new cmGlobalVisualStudio9Generator(cm, name, "");
name, "");
} }
if(p[0] != ' ') if(p[0] != ' ')
@ -46,14 +45,12 @@ public:
if(!strcmp(p, "IA64")) if(!strcmp(p, "IA64"))
{ {
return new cmGlobalVisualStudio9Generator( return new cmGlobalVisualStudio9Generator(cm, name, "Itanium");
name, "Itanium");
} }
if(!strcmp(p, "Win64")) if(!strcmp(p, "Win64"))
{ {
return new cmGlobalVisualStudio9Generator( return new cmGlobalVisualStudio9Generator(cm, name, "x64");
name, "x64");
} }
cmVisualStudioWCEPlatformParser parser(p); cmVisualStudioWCEPlatformParser parser(p);
@ -63,8 +60,8 @@ public:
return 0; return 0;
} }
cmGlobalVisualStudio9Generator* ret = new cmGlobalVisualStudio9Generator( cmGlobalVisualStudio9Generator* ret =
name, p); new cmGlobalVisualStudio9Generator(cm, name, p);
ret->WindowsCEVersion = parser.GetOSVersion(); ret->WindowsCEVersion = parser.GetOSVersion();
return ret; return ret;
} }
@ -100,9 +97,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(cmake* cm,
const std::string& name, const std::string& platformName) const std::string& name, const std::string& platformName)
: cmGlobalVisualStudio8Generator(name, platformName) : cmGlobalVisualStudio8Generator(cm, name, platformName)
{ {
this->Version = VS9; this->Version = VS9;
} }

View File

@ -24,7 +24,7 @@ class cmGlobalVisualStudio9Generator :
public cmGlobalVisualStudio8Generator public cmGlobalVisualStudio8Generator
{ {
public: public:
cmGlobalVisualStudio9Generator(const std::string& name, cmGlobalVisualStudio9Generator(cmake* cm, const std::string& name,
const std::string& platformName); const std::string& platformName);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();

View File

@ -21,10 +21,11 @@
#include <cmsys/Encoding.hxx> #include <cmsys/Encoding.hxx>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm)
: cmGlobalGenerator(cm)
{ {
this->WindowsShell = true; cm->GetState()->SetWindowsShell(true);
this->WindowsVSIDE = true; cm->GetState()->SetWindowsVSIDE(true);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ public:
VS14 = 140 VS14 = 140
}; };
cmGlobalVisualStudioGenerator(); cmGlobalVisualStudioGenerator(cmake* cm);
virtual ~cmGlobalVisualStudioGenerator(); virtual ~cmGlobalVisualStudioGenerator();
VSVersion GetVersion() const; VSVersion GetVersion() const;

View File

@ -13,7 +13,8 @@
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator() cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
: cmGlobalUnixMakefileGenerator3(cm)
{ {
this->FindMakeProgramFile = "CMakeFindWMake.cmake"; this->FindMakeProgramFile = "CMakeFindWMake.cmake";
#ifdef _WIN32 #ifdef _WIN32
@ -23,9 +24,9 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator()
this->NeedSymbolicMark = true; this->NeedSymbolicMark = true;
this->EmptyRuleHackCommand = "@cd ."; this->EmptyRuleHackCommand = "@cd .";
#ifdef _WIN32 #ifdef _WIN32
this->WindowsShell = true; cm->GetState()->SetWindowsShell(true);
#endif #endif
this->WatcomWMake = true; cm->GetState()->SetWatcomWMake(true);
this->IncludeDirective = "!include"; this->IncludeDirective = "!include";
this->DefineWindowsNULL = true; this->DefineWindowsNULL = true;
this->UnixCD = false; this->UnixCD = false;

View File

@ -22,7 +22,7 @@
class cmGlobalWatcomWMakeGenerator : public cmGlobalUnixMakefileGenerator3 class cmGlobalWatcomWMakeGenerator : public cmGlobalUnixMakefileGenerator3
{ {
public: public:
cmGlobalWatcomWMakeGenerator(); cmGlobalWatcomWMakeGenerator(cmake* cm);
static cmGlobalGeneratorFactory* NewFactory() { static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory return new cmGlobalGeneratorSimpleFactory
<cmGlobalWatcomWMakeGenerator>(); } <cmGlobalWatcomWMakeGenerator>(); }

View File

@ -117,8 +117,8 @@ public:
class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
{ {
public: public:
virtual cmGlobalGenerator* CreateGlobalGenerator( virtual cmGlobalGenerator*
const std::string& name) const; CreateGlobalGenerator(const std::string& name, cmake* cm) const;
virtual void GetDocumentation(cmDocumentationEntry& entry) const { virtual void GetDocumentation(cmDocumentationEntry& entry) const {
cmGlobalXCodeGenerator::GetDocumentation(entry); } cmGlobalXCodeGenerator::GetDocumentation(entry); }
@ -128,7 +128,9 @@ public:
}; };
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version) cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(cmake* cm,
std::string const& version)
: cmGlobalGenerator(cm)
{ {
this->VersionString = version; this->VersionString = version;
@ -154,7 +156,7 @@ cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalGenerator* cmGlobalXCodeGenerator::Factory cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
::CreateGlobalGenerator(const std::string& name) const ::CreateGlobalGenerator(const std::string& name, cmake* cm) const
{ {
if (name != GetActualName()) if (name != GetActualName())
return 0; return 0;
@ -187,7 +189,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
("/Developer/Applications/Xcode.app/Contents/version.plist"); ("/Developer/Applications/Xcode.app/Contents/version.plist");
} }
cmsys::auto_ptr<cmGlobalXCodeGenerator> cmsys::auto_ptr<cmGlobalXCodeGenerator>
gg(new cmGlobalXCodeGenerator(parser.Version)); gg(new cmGlobalXCodeGenerator(cm, parser.Version));
if (gg->XcodeVersion == 20) if (gg->XcodeVersion == 20)
{ {
cmSystemTools::Message("Xcode 2.0 not really supported by cmake, " cmSystemTools::Message("Xcode 2.0 not really supported by cmake, "
@ -198,7 +200,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
#else #else
std::cerr << "CMake should be built with cmake to use Xcode, " std::cerr << "CMake should be built with cmake to use Xcode, "
"default to Xcode 1.5\n"; "default to Xcode 1.5\n";
return new cmGlobalXCodeGenerator; return new cmGlobalXCodeGenerator(cm);
#endif #endif
} }
@ -369,9 +371,10 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
cmLocalGenerator * cmLocalGenerator *
cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent) cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
cmState::Snapshot snapshot)
{ {
return new cmLocalXCodeGenerator(this, parent); return new cmLocalXCodeGenerator(this, parent, snapshot);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@ class cmSourceGroup;
class cmGlobalXCodeGenerator : public cmGlobalGenerator class cmGlobalXCodeGenerator : public cmGlobalGenerator
{ {
public: public:
cmGlobalXCodeGenerator(std::string const& version); cmGlobalXCodeGenerator(cmake* cm, std::string const& version);
static cmGlobalGeneratorFactory* NewFactory(); static cmGlobalGeneratorFactory* NewFactory();
///! Get the name for the generator. ///! Get the name for the generator.
@ -41,7 +41,8 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry); static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator ///! 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 * Try to determine system information such as shared library

View File

@ -67,8 +67,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cmake cm; cmake cm;
cm.SetHomeDirectory(""); cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cmGlobalGenerator ggi; cmGlobalGenerator ggi(&cm);
ggi.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(ggi.MakeLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(ggi.MakeLocalGenerator());
cmMakefile *mf = lg->GetMakefile(); cmMakefile *mf = lg->GetMakefile();

View File

@ -44,21 +44,18 @@
#endif #endif
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent) cmLocalGenerator* parent,
cmState::Snapshot snapshot)
: StateSnapshot(snapshot)
{ {
assert(snapshot.IsValid());
this->GlobalGenerator = gg; this->GlobalGenerator = gg;
this->Parent = parent; this->Parent = parent;
if (parent) if (parent)
{ {
parent->AddChild(this); parent->AddChild(this);
this->StateSnapshot =
this->GetState()->CreateSnapshot(parent->StateSnapshot);
}
else
{
this->StateSnapshot =
this->GetState()->CreateSnapshot(cmState::Snapshot(this->GetState()));
} }
this->Makefile = new cmMakefile(this); this->Makefile = new cmMakefile(this);
this->LinkScriptShell = false; this->LinkScriptShell = false;
@ -84,11 +81,14 @@ class cmLocalGeneratorCurrent
{ {
cmGlobalGenerator* GG; cmGlobalGenerator* GG;
cmLocalGenerator* LG; cmLocalGenerator* LG;
cmState::Snapshot Snapshot;
public: public:
cmLocalGeneratorCurrent(cmLocalGenerator* lg) cmLocalGeneratorCurrent(cmLocalGenerator* lg)
{ {
this->GG = lg->GetGlobalGenerator(); this->GG = lg->GetGlobalGenerator();
this->LG = this->GG->GetCurrentLocalGenerator(); this->LG = this->GG->GetCurrentLocalGenerator();
this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot();
this->GG->GetCMakeInstance()->SetCurrentSnapshot(lg->GetStateSnapshot());
this->GG->SetCurrentLocalGenerator(lg); this->GG->SetCurrentLocalGenerator(lg);
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
this->GG->GetFileLockPool().PushFileScope(); this->GG->GetFileLockPool().PushFileScope();
@ -100,6 +100,7 @@ public:
this->GG->GetFileLockPool().PopFileScope(); this->GG->GetFileLockPool().PopFileScope();
#endif #endif
this->GG->SetCurrentLocalGenerator(this->LG); this->GG->SetCurrentLocalGenerator(this->LG);
this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot);
} }
}; };
@ -1175,7 +1176,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote,
// If this is a windows shell, the result has a space, and the path // If this is a windows shell, the result has a space, and the path
// already exists, we can use a short-path to reference it without a // already exists, we can use a short-path to reference it without a
// space. // space.
if(this->GlobalGenerator->WindowsShell && result.find(' ') != result.npos && if(this->GetState()->UseWindowsShell() && result.find(' ') != result.npos &&
cmSystemTools::FileExists(remote.c_str())) cmSystemTools::FileExists(remote.c_str()))
{ {
std::string tmp; std::string tmp;
@ -2583,7 +2584,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
{ {
// Append the definition with proper escaping. // Append the definition with proper escaping.
std::string def = dflag; std::string def = dflag;
if(this->GlobalGenerator->WatcomWMake) if(this->GetState()->UseWatcomWMake())
{ {
// The Watcom compiler does its own command line parsing instead // The Watcom compiler does its own command line parsing instead
// of using the windows shell rules. Definitions are one of // of using the windows shell rules. Definitions are one of
@ -2753,7 +2754,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
// For the MSYS shell convert drive letters to posix paths, so // For the MSYS shell convert drive letters to posix paths, so
// that c:/some/path becomes /c/some/path. This is needed to // that c:/some/path becomes /c/some/path. This is needed to
// avoid problems with the shell path translation. // avoid problems with the shell path translation.
if(this->GlobalGenerator->MSYSShell && !this->LinkScriptShell) if(this->GetState()->UseMSYSShell() && !this->LinkScriptShell)
{ {
if(result.size() > 2 && result[1] == ':') if(result.size() > 2 && result[1] == ':')
{ {
@ -2761,7 +2762,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
result[0] = '/'; result[0] = '/';
} }
} }
if(this->GlobalGenerator->WindowsShell) if(this->GetState()->UseWindowsShell())
{ {
std::replace(result.begin(), result.end(), '/', '\\'); std::replace(result.begin(), result.end(), '/', '\\');
} }
@ -3176,22 +3177,22 @@ void cmLocalGenerator::ComputeObjectFilenames(
bool cmLocalGenerator::IsWindowsShell() const bool cmLocalGenerator::IsWindowsShell() const
{ {
return this->GlobalGenerator->WindowsShell; return this->GetState()->UseWindowsShell();
} }
bool cmLocalGenerator::IsWatcomWMake() const bool cmLocalGenerator::IsWatcomWMake() const
{ {
return this->GlobalGenerator->WatcomWMake; return this->GetState()->UseWatcomWMake();
} }
bool cmLocalGenerator::IsMinGWMake() const bool cmLocalGenerator::IsMinGWMake() const
{ {
return this->GlobalGenerator->MinGWMake; return this->GetState()->UseMinGWMake();
} }
bool cmLocalGenerator::IsNMake() const bool cmLocalGenerator::IsNMake() const
{ {
return this->GlobalGenerator->NMake; return this->GetState()->UseNMake();
} }
void cmLocalGenerator::SetConfiguredCMP0014(bool configured) void cmLocalGenerator::SetConfiguredCMP0014(bool configured)
@ -3342,7 +3343,7 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str,
// Compute the flags for the target shell environment. // Compute the flags for the target shell environment.
int flags = 0; int flags = 0;
if(this->GlobalGenerator->WindowsVSIDE) if(this->GetState()->UseWindowsVSIDE())
{ {
flags |= cmsysSystem_Shell_Flag_VSIDE; flags |= cmsysSystem_Shell_Flag_VSIDE;
} }
@ -3362,27 +3363,27 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str,
{ {
flags |= cmsysSystem_Shell_Flag_WatcomQuote; flags |= cmsysSystem_Shell_Flag_WatcomQuote;
} }
if(this->GlobalGenerator->WatcomWMake) if(this->GetState()->UseWatcomWMake())
{ {
flags |= cmsysSystem_Shell_Flag_WatcomWMake; flags |= cmsysSystem_Shell_Flag_WatcomWMake;
} }
if(this->GlobalGenerator->MinGWMake) if(this->GetState()->UseMinGWMake())
{ {
flags |= cmsysSystem_Shell_Flag_MinGWMake; flags |= cmsysSystem_Shell_Flag_MinGWMake;
} }
if(this->GlobalGenerator->NMake) if(this->GetState()->UseNMake())
{ {
flags |= cmsysSystem_Shell_Flag_NMake; flags |= cmsysSystem_Shell_Flag_NMake;
} }
// Compute the buffer size needed. // Compute the buffer size needed.
int size = (this->GlobalGenerator->WindowsShell ? int size = (this->GetState()->UseWindowsShell() ?
cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) :
cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags));
// Compute the shell argument itself. // Compute the shell argument itself.
std::vector<char> arg(size); std::vector<char> arg(size);
if(this->GlobalGenerator->WindowsShell) if(this->GetState()->UseWindowsShell())
{ {
cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags);
} }

View File

@ -34,7 +34,8 @@ class cmCustomCommandGenerator;
class cmLocalGenerator class cmLocalGenerator
{ {
public: public:
cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent); cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual ~cmLocalGenerator(); virtual ~cmLocalGenerator();
/// @return whether we are processing the top CMakeLists.txt file. /// @return whether we are processing the top CMakeLists.txt file.

View File

@ -17,8 +17,9 @@
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent) cmLocalGenerator* parent,
: cmLocalGenerator(gg, parent) cmState::Snapshot snapshot)
: cmLocalGenerator(gg, parent, snapshot)
{ {
} }

View File

@ -25,7 +25,8 @@ class cmGeneratedFileStream;
class cmLocalGhsMultiGenerator : public cmLocalGenerator class cmLocalGhsMultiGenerator : public cmLocalGenerator
{ {
public: public:
cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent); cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual ~cmLocalGhsMultiGenerator(); virtual ~cmLocalGhsMultiGenerator();

View File

@ -23,8 +23,9 @@
#include <assert.h> #include <assert.h>
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent) cmLocalGenerator* parent,
: cmLocalGenerator(gg, parent) cmState::Snapshot snapshot)
: cmLocalGenerator(gg, parent, snapshot)
, ConfigName("") , ConfigName("")
, HomeRelativeOutputPath("") , HomeRelativeOutputPath("")
{ {

View File

@ -31,7 +31,8 @@ class cmake;
class cmLocalNinjaGenerator : public cmLocalGenerator class cmLocalNinjaGenerator : public cmLocalGenerator
{ {
public: public:
cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent); cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual ~cmLocalNinjaGenerator(); virtual ~cmLocalNinjaGenerator();

View File

@ -80,8 +80,9 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmLocalUnixMakefileGenerator3:: cmLocalUnixMakefileGenerator3::
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent) cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent,
: cmLocalGenerator(gg, parent) cmState::Snapshot snapshot)
: cmLocalGenerator(gg, parent, snapshot)
{ {
this->MakefileVariableSize = 0; this->MakefileVariableSize = 0;
this->ColorMakefile = false; this->ColorMakefile = false;

View File

@ -35,7 +35,8 @@ class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator
{ {
public: public:
cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
cmLocalGenerator* parent); cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual ~cmLocalUnixMakefileGenerator3(); virtual ~cmLocalUnixMakefileGenerator3();
/** /**

View File

@ -63,8 +63,9 @@ class cmVS10XMLParser : public cmXMLParser
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmLocalVisualStudio10Generator cmLocalVisualStudio10Generator
::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, ::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent): cmLocalGenerator* parent,
cmLocalVisualStudio7Generator(gg, parent) cmState::Snapshot snapshot):
cmLocalVisualStudio7Generator(gg, parent, snapshot)
{ {
} }

View File

@ -26,7 +26,8 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
public: public:
///! Set cache only and recurse to false by default. ///! Set cache only and recurse to false by default.
cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent); cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudio10Generator(); virtual ~cmLocalVisualStudio10Generator();

View File

@ -25,8 +25,9 @@
cmLocalVisualStudio6Generator cmLocalVisualStudio6Generator
::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, ::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent): cmLocalGenerator* parent,
cmLocalVisualStudioGenerator(gg, parent) cmState::Snapshot snapshot):
cmLocalVisualStudioGenerator(gg, parent, snapshot)
{ {
} }

View File

@ -30,7 +30,8 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator
public: public:
///! Set cache only and recurse to false by default. ///! Set cache only and recurse to false by default.
cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent); cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudio6Generator(); virtual ~cmLocalVisualStudio6Generator();

View File

@ -56,8 +56,9 @@ static void cmConvertToWindowsSlash(std::string& s)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmLocalVisualStudio7Generator cmLocalVisualStudio7Generator
::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, ::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent): cmLocalGenerator* parent,
cmLocalVisualStudioGenerator(gg, parent) cmState::Snapshot snapshot):
cmLocalVisualStudioGenerator(gg, parent, snapshot)
{ {
this->Internal = new cmLocalVisualStudio7GeneratorInternals(this); this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
} }

View File

@ -36,7 +36,8 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
public: public:
///! Set cache only and recurse to false by default. ///! Set cache only and recurse to false by default.
cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
cmLocalGenerator* parent); cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudio7Generator(); virtual ~cmLocalVisualStudio7Generator();

View File

@ -20,8 +20,9 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmLocalVisualStudioGenerator cmLocalVisualStudioGenerator
::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, ::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent) cmLocalGenerator* parent,
: cmLocalGenerator(gg, parent) cmState::Snapshot snapshot)
: cmLocalGenerator(gg, parent, snapshot)
{ {
} }

View File

@ -32,7 +32,8 @@ class cmLocalVisualStudioGenerator : public cmLocalGenerator
{ {
public: public:
cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent); cmLocalGenerator* parent,
cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudioGenerator(); virtual ~cmLocalVisualStudioGenerator();
/** Construct a script from the given list of command lines. */ /** Construct a script from the given list of command lines. */

View File

@ -16,8 +16,9 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent) cmLocalGenerator* parent,
: cmLocalGenerator(gg, parent) cmState::Snapshot snapshot)
: cmLocalGenerator(gg, parent, snapshot)
{ {
// the global generator does this, so do not // the global generator does this, so do not
// put these flags into the language flags // put these flags into the language flags

View File

@ -24,7 +24,8 @@ class cmLocalXCodeGenerator : public cmLocalGenerator
{ {
public: public:
///! Set cache only and recurse to false by default. ///! 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 ~cmLocalXCodeGenerator();
virtual std::string GetTargetDirectory(cmTarget const& target) const; virtual std::string GetTargetDirectory(cmTarget const& target) const;

View File

@ -1618,9 +1618,12 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
return; return;
} }
cmState::Snapshot newSnapshot = this->GetState()
->CreateSnapshot(this->StateSnapshot);
// create a new local generator and set its parent // create a new local generator and set its parent
cmLocalGenerator *lg2 = this->GetGlobalGenerator() cmLocalGenerator *lg2 = this->GetGlobalGenerator()
->MakeLocalGenerator(this->LocalGenerator); ->MakeLocalGenerator(newSnapshot, this->LocalGenerator);
this->GetGlobalGenerator()->AddLocalGenerator(lg2); this->GetGlobalGenerator()->AddLocalGenerator(lg2);
// set the subdirs start dirs // set the subdirs start dirs

View File

@ -1210,8 +1210,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cmake cm; cmake cm;
cm.SetHomeOutputDirectory(targetDirectory); cm.SetHomeOutputDirectory(targetDirectory);
cm.SetHomeDirectory(targetDirectory); cm.SetHomeDirectory(targetDirectory);
cmGlobalGenerator gg; cmGlobalGenerator gg(&cm);
gg.SetCMakeInstance(&cm);
cmLocalGenerator* lg = gg.MakeLocalGenerator(); cmLocalGenerator* lg = gg.MakeLocalGenerator();
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);

View File

@ -20,9 +20,14 @@
cmState::cmState(cmake* cm) cmState::cmState(cmake* cm)
: CMakeInstance(cm), : CMakeInstance(cm),
IsInTryCompile(false) IsInTryCompile(false),
WindowsShell(false),
WindowsVSIDE(false),
WatcomWMake(false),
MinGWMake(false),
NMake(false),
MSYSShell(false)
{ {
this->Initialize();
} }
cmState::~cmState() cmState::~cmState()
@ -190,19 +195,35 @@ void cmState::RemoveCacheEntryProperty(std::string const& key,
->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0); ->GetCacheIterator(key.c_str()).SetProperty(propertyName, (void*)0);
} }
void cmState::Initialize() void cmState::Reset()
{ {
this->GlobalProperties.clear(); this->GlobalProperties.clear();
this->PropertyDefinitions.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 this->DefineProperty
("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY, ("RULE_LAUNCH_COMPILE", cmProperty::DIRECTORY,
"", "", true); "", "", true);
@ -488,6 +509,66 @@ void cmState::SetBinaryDirectory(std::string const& binaryDirectory)
this->BinaryDirectoryComponents); 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 const char* cmState::GetBinaryDirectory() const
{ {
return this->BinaryDirectory.c_str(); return this->BinaryDirectory.c_str();
@ -580,6 +661,10 @@ void cmState::Snapshot::ComputeRelativePathTopBinary()
cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot) cmState::Snapshot cmState::CreateSnapshot(Snapshot originSnapshot)
{ {
if (!originSnapshot.IsValid())
{
originSnapshot.State = this;
}
PositionType pos = this->ParentPositions.size(); PositionType pos = this->ParentPositions.size();
this->ParentPositions.push_back(originSnapshot.Position); this->ParentPositions.push_back(originSnapshot.Position);
this->Locations.resize(this->Locations.size() + 1); 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) void cmState::Snapshot::SetCurrentSourceDirectory(std::string const& dir)
{ {
assert(this->State);
assert(this->State->Locations.size() > this->Position); assert(this->State->Locations.size() > this->Position);
this->State->Locations[this->Position] = dir; this->State->Locations[this->Position] = dir;
cmSystemTools::ConvertToUnixSlashes( cmSystemTools::ConvertToUnixSlashes(
@ -681,15 +767,12 @@ bool cmState::Snapshot::IsValid() const
cmState::Snapshot cmState::Snapshot::GetParent() const cmState::Snapshot cmState::Snapshot::GetParent() const
{ {
Snapshot snapshot; Snapshot snapshot;
if (!this->State) if (!this->State || this->Position == 0)
{ {
return snapshot; return snapshot;
} }
PositionType parentPos = this->State->ParentPositions[this->Position]; PositionType parentPos = this->State->ParentPositions[this->Position];
if (parentPos > 0) snapshot = Snapshot(this->State, parentPos);
{
snapshot = Snapshot(this->State, parentPos);
}
return snapshot; return snapshot;
} }

View File

@ -93,7 +93,7 @@ public:
void RemoveCacheEntryProperty(std::string const& key, void RemoveCacheEntryProperty(std::string const& key,
std::string const& propertyName); std::string const& propertyName);
void Initialize(); void Reset();
// Define a property // Define a property
void DefineProperty(const std::string& name, cmProperty::ScopeType scope, void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const char *ShortDescription, const char *ShortDescription,
@ -138,6 +138,19 @@ public:
std::vector<std::string> const& GetSourceDirectoryComponents() const; std::vector<std::string> const& GetSourceDirectoryComponents() const;
std::vector<std::string> const& GetBinaryDirectoryComponents() const; std::vector<std::string> const& GetBinaryDirectoryComponents() const;
void SetWindowsShell(bool windowsShell);
bool UseWindowsShell() const;
void SetWindowsVSIDE(bool windowsVSIDE);
bool UseWindowsVSIDE() const;
void SetWatcomWMake(bool watcomWMake);
bool UseWatcomWMake() const;
void SetMinGWMake(bool minGWMake);
bool UseMinGWMake() const;
void SetNMake(bool nMake);
bool UseNMake() const;
void SetMSYSShell(bool mSYSShell);
bool UseMSYSShell() const;
private: private:
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions; std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
std::vector<std::string> EnabledLanguages; std::vector<std::string> EnabledLanguages;
@ -163,6 +176,12 @@ private:
std::string SourceDirectory; std::string SourceDirectory;
std::string BinaryDirectory; std::string BinaryDirectory;
bool IsInTryCompile; bool IsInTryCompile;
bool WindowsShell;
bool WindowsVSIDE;
bool WatcomWMake;
bool MinGWMake;
bool NMake;
bool MSYSShell;
}; };
#endif #endif

View File

@ -134,6 +134,7 @@ cmake::cmake()
this->Policies = new cmPolicies(); this->Policies = new cmPolicies();
this->State = new cmState(this); this->State = new cmState(this);
this->CurrentSnapshot = this->State->CreateSnapshot(cmState::Snapshot());
#ifdef __APPLE__ #ifdef __APPLE__
struct rlimit rlp; struct rlimit rlp;
@ -185,7 +186,7 @@ cmake::~cmake()
void cmake::CleanupCommandsAndMacros() void cmake::CleanupCommandsAndMacros()
{ {
this->State->Initialize(); this->State->Reset();
this->State->RemoveUserDefinedCommands(); this->State->RemoveUserDefinedCommands();
} }
@ -362,8 +363,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
// if a generator was not specified use a generic one // if a generator was not specified use a generic one
if (!gg) if (!gg)
{ {
gg = new cmGlobalGenerator; gg = new cmGlobalGenerator(this);
gg->SetCMakeInstance(this);
created = true; created = true;
} }
@ -411,8 +411,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
(cmSystemTools::GetCurrentWorkingDirectory()); (cmSystemTools::GetCurrentWorkingDirectory());
// if a generator was not yet created, temporarily create one // if a generator was not yet created, temporarily create one
cmGlobalGenerator *gg = new cmGlobalGenerator; cmGlobalGenerator *gg = new cmGlobalGenerator(this);
gg->SetCMakeInstance(this);
this->SetGlobalGenerator(gg); this->SetGlobalGenerator(gg);
// read in the list file to fill the cache // read in the list file to fill the cache
@ -951,7 +950,7 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
for (RegisteredGeneratorsVector::const_iterator i = for (RegisteredGeneratorsVector::const_iterator i =
this->Generators.begin(); i != this->Generators.end(); ++i) this->Generators.begin(); i != this->Generators.end(); ++i)
{ {
generator = (*i)->CreateGlobalGenerator(name); generator = (*i)->CreateGlobalGenerator(name, this);
if (generator) if (generator)
{ {
break; break;
@ -960,7 +959,6 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
if (generator) if (generator)
{ {
generator->SetCMakeInstance(this);
generator->SetExternalMakefileProjectGenerator(extraGenerator); generator->SetExternalMakefileProjectGenerator(extraGenerator);
} }
else else
@ -1045,8 +1043,6 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
{ {
this->CCEnvironment = ""; this->CCEnvironment = "";
} }
// set the cmake instance just to be sure
gg->SetCMakeInstance(this);
} }
int cmake::DoPreConfigureChecks() int cmake::DoPreConfigureChecks()
@ -1299,12 +1295,12 @@ int cmake::ActualConfigure()
= this->CreateGlobalGenerator(installedCompiler.c_str()); = this->CreateGlobalGenerator(installedCompiler.c_str());
if(!gen) if(!gen)
{ {
gen = new cmGlobalNMakeMakefileGenerator; gen = new cmGlobalNMakeMakefileGenerator(this);
} }
this->SetGlobalGenerator(gen); this->SetGlobalGenerator(gen);
std::cout << "-- Building for: " << gen->GetName() << "\n"; std::cout << "-- Building for: " << gen->GetName() << "\n";
#else #else
this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator3); this->SetGlobalGenerator(new cmGlobalUnixMakefileGenerator3(this));
#endif #endif
} }
if(!this->GlobalGenerator) if(!this->GlobalGenerator)
@ -1917,8 +1913,7 @@ int cmake::CheckBuildSystem()
cmake cm; cmake cm;
cm.SetHomeDirectory(""); cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg; cmGlobalGenerator gg(&cm);
gg.SetCMakeInstance(&cm);
cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
cmMakefile* mf = lg->GetMakefile(); cmMakefile* mf = lg->GetMakefile();
if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||

View File

@ -316,6 +316,10 @@ class cmake
void WatchUnusedCli(const std::string& var); void WatchUnusedCli(const std::string& var);
cmState* GetState() const { return this->State; } cmState* GetState() const { return this->State; }
void SetCurrentSnapshot(cmState::Snapshot snapshot)
{ this->CurrentSnapshot = snapshot; }
cmState::Snapshot GetCurrentSnapshot() const
{ return this->CurrentSnapshot; }
protected: protected:
void RunCheckForUnusedVariables(); void RunCheckForUnusedVariables();
@ -396,6 +400,7 @@ private:
InstalledFilesMap InstalledFiles; InstalledFilesMap InstalledFiles;
cmState* State; cmState* State;
cmState::Snapshot CurrentSnapshot;
void UpdateConversionPathTable(); void UpdateConversionPathTable();