[Cmake-commits] CMake branch, next, updated. v3.3.1-2597-ga741812
Stephen Kelly
steveire at gmail.com
Fri Aug 28 12:44:15 EDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via a741812b5189b0d0d61d7b1119410e8b0f722613 (commit)
via 900816d1c3ede65e83e3de4253a5a560a3e4c994 (commit)
from 7507ca2302b7c34bf08c83cfe2c7cc1f6be0a57e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a741812b5189b0d0d61d7b1119410e8b0f722613
commit a741812b5189b0d0d61d7b1119410e8b0f722613
Merge: 7507ca2 900816d
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Aug 28 12:44:14 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Aug 28 12:44:14 2015 -0400
Merge topic 'generate-time-generators' into next
900816d1 Revert topic.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=900816d1c3ede65e83e3de4253a5a560a3e4c994
commit 900816d1c3ede65e83e3de4253a5a560a3e4c994
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Aug 28 18:43:32 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Aug 28 18:43:39 2015 +0200
Revert topic.
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 92a4b2b..bf4df60 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -716,10 +716,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.AddCMakePaths();
cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmMakefile> mf(
- new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(
- gg.CreateLocalGenerator(mf.get()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
+ cmMakefile *mf = lg->GetMakefile();
std::string realInstallDirectory = tempInstallDirectory;
if ( !installSubDirectory.empty() && installSubDirectory != "/" )
{
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index cb9cbc4..c2fe763 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -202,10 +202,8 @@ int main (int argc, char const* const* argv)
cminst.SetHomeOutputDirectory("");
cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg(&cminst);
- cmsys::auto_ptr<cmMakefile> globalMF(
- new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> cmlg(
- cmgg.CreateLocalGenerator(globalMF.get()));
+ cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.MakeLocalGenerator());
+ cmMakefile* globalMF = cmlg->GetMakefile();
#if defined(__CYGWIN__)
globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");
#endif
@@ -359,8 +357,8 @@ int main (int argc, char const* const* argv)
++it )
{
const char* gen = it->c_str();
- cmMakefile::ScopePushPop raii(globalMF.get());
- cmMakefile* mf = globalMF.get();
+ cmMakefile::ScopePushPop raii(globalMF);
+ cmMakefile* mf = globalMF;
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Specified generator: " << gen << std::endl);
if ( parsed && !mf->GetDefinition("CPACK_PACKAGE_NAME") )
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index fb0cce6..0f588c5 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -738,9 +738,8 @@ void cmCTestLaunch::LoadConfig()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(
- gg.CreateLocalGenerator(mf.get()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
+ cmMakefile* mf = lg->GetMakefile();
std::string fname = this->LogDir;
fname += "CTestLaunchConfig.cmake";
if(cmSystemTools::FileExists(fname.c_str()) &&
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 9154716..047bd98 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -125,25 +125,42 @@ void cmCTestScriptHandler::Initialize()
// what time in seconds did this script start running
this->ScriptStartTime = 0;
- delete this->Makefile;
this->Makefile = 0;
-
- delete this->LocalGenerator;
+ if (this->LocalGenerator)
+ {
+ delete this->LocalGenerator;
+ }
this->LocalGenerator = 0;
-
- delete this->GlobalGenerator;
+ if (this->GlobalGenerator)
+ {
+ delete this->GlobalGenerator;
+ }
this->GlobalGenerator = 0;
-
- delete this->CMake;
+ if (this->CMake)
+ {
+ delete this->CMake;
+ }
}
//----------------------------------------------------------------------
cmCTestScriptHandler::~cmCTestScriptHandler()
{
- delete this->Makefile;
- delete this->LocalGenerator;
- delete this->GlobalGenerator;
- delete this->CMake;
+ // local generator owns the makefile
+ this->Makefile = 0;
+ if (this->LocalGenerator)
+ {
+ delete this->LocalGenerator;
+ }
+ this->LocalGenerator = 0;
+ if (this->GlobalGenerator)
+ {
+ delete this->GlobalGenerator;
+ }
+ this->GlobalGenerator = 0;
+ if (this->CMake)
+ {
+ delete this->CMake;
+ }
}
@@ -317,7 +334,6 @@ void cmCTestScriptHandler::CreateCMake()
delete this->CMake;
delete this->GlobalGenerator;
delete this->LocalGenerator;
- delete this->Makefile;
}
this->CMake = new cmake;
this->CMake->SetHomeDirectory("");
@@ -325,10 +341,7 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->AddCMakePaths();
this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
- cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot();
- this->Makefile = new cmMakefile(this->GlobalGenerator, snapshot);
- this->LocalGenerator =
- this->GlobalGenerator->CreateLocalGenerator(this->Makefile);
+ this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator();
this->Makefile = this->LocalGenerator->GetMakefile();
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index a523f57..c8a0d27 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1592,9 +1592,8 @@ void cmCTestTestHandler::GetListOfTests()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(
- gg.CreateLocalGenerator(mf.get()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
+ cmMakefile *mf = lg->GetMakefile();
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str());
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index adefd1c..b976469 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -520,10 +520,9 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
- if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(),
- mf.get()) )
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
+ cmMakefile *mf = lg->GetMakefile();
+ if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )
{
cmCTestOptionalLog(this, DEBUG,
"Cannot find custom configuration file tree" << std::endl, quiet);
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 40e8d29..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(
- cmMakefile *mf)
+ cmLocalGenerator* parent, cmState::Snapshot snapshot)
{
cmLocalUnixMakefileGenerator3* lg =
- new cmLocalUnixMakefileGenerator3(this, mf);
+ 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 b59c86d..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(cmMakefile* mf);
+ 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 cb272f3..46c1ccc 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1127,38 +1127,23 @@ void cmGlobalGenerator::Configure()
this->FirstTimeProgress = 0.0f;
this->ClearGeneratorMembers();
- cmMakefile* dirMf =
- new cmMakefile(this, this->GetCMakeInstance()->GetCurrentSnapshot());
- this->AddMakefile(dirMf);
+ // start with this directory
+ cmLocalGenerator *lg = this->MakeLocalGenerator();
+ this->Makefiles.push_back(lg->GetMakefile());
+ this->LocalGenerators.push_back(lg);
// set the Start directories
- dirMf->SetCurrentSourceDirectory
+ lg->GetMakefile()->SetCurrentSourceDirectory
(this->CMakeInstance->GetHomeDirectory());
- dirMf->SetCurrentBinaryDirectory
+ lg->GetMakefile()->SetCurrentBinaryDirectory
(this->CMakeInstance->GetHomeOutputDirectory());
this->BinaryDirectories.insert(
this->CMakeInstance->GetHomeOutputDirectory());
// now do it
- dirMf->Configure();
- dirMf->EnforceDirectoryLevelRules();
-
- // Put a copy of each global target in every directory.
- cmTargets globalTargets;
- this->CreateDefaultGlobalTargets(&globalTargets);
-
- for (unsigned int i = 0; i < this->Makefiles.size(); ++i)
- {
- cmMakefile* mf = this->Makefiles[i];
- cmTargets* targets = &(mf->GetTargets());
- cmTargets::iterator tit;
- for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
- {
- (*targets)[tit->first] = tit->second;
- (*targets)[tit->first].SetMakefile(mf);
- }
- }
+ lg->GetMakefile()->Configure();
+ lg->GetMakefile()->EnforceDirectoryLevelRules();
// update the cache entry for the number of local generators, this is used
// for progress
@@ -1170,7 +1155,11 @@ void cmGlobalGenerator::Configure()
// check for link libraries and include directories containing "NOTFOUND"
// and for infinite loops
- this->CheckTargetProperties();
+ this->CheckLocalGenerators();
+
+ // at this point this->LocalGenerators has been filled,
+ // so create the map from project name to vector of local generators
+ this->FillProjectMap();
if ( this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE)
{
@@ -1197,23 +1186,29 @@ void cmGlobalGenerator::Configure()
}
this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1);
}
-}
-void cmGlobalGenerator::CreateLocalGenerators()
-{
- cmDeleteAll(this->LocalGenerators);
- this->LocalGenerators.clear();
- this->LocalGenerators.reserve(this->Makefiles.size());
- for (std::vector<cmMakefile*>::const_iterator it = this->Makefiles.begin();
- it != this->Makefiles.end(); ++it)
+ unsigned int i;
+
+ // Put a copy of each global target in every directory.
+ cmTargets globalTargets;
+ this->CreateDefaultGlobalTargets(&globalTargets);
+
+ for (i = 0; i < this->Makefiles.size(); ++i)
{
- this->LocalGenerators.push_back(this->CreateLocalGenerator(*it));
+ cmMakefile* mf = this->Makefiles[i];
+ cmTargets* targets = &(mf->GetTargets());
+ cmTargets::iterator tit;
+ for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
+ {
+ (*targets)[tit->first] = tit->second;
+ (*targets)[tit->first].SetMakefile(mf);
+ }
}
+
}
void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
{
- this->CreateLocalGenerators();
cmDeleteAll(this->GeneratorTargets);
this->GeneratorTargets.clear();
this->CreateGeneratorTargets(targetTypes);
@@ -1272,10 +1267,6 @@ bool cmGlobalGenerator::Compute()
this->CreateGenerationObjects();
- // at this point this->LocalGenerators has been filled,
- // so create the map from project name to vector of local generators
- this->FillProjectMap();
-
#ifdef CMAKE_BUILD_WITH_CMAKE
// Iterate through all targets and set up automoc for those which have
// the AUTOMOC, AUTOUIC or AUTORCC property set
@@ -1609,7 +1600,6 @@ void cmGlobalGenerator::ClearGeneratorMembers()
cmDeleteAll(this->BuildExportSets);
this->BuildExportSets.clear();
- cmDeleteAll(this->Makefiles);
this->Makefiles.clear();
cmDeleteAll(this->LocalGenerators);
@@ -1644,7 +1634,7 @@ void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
{
}
-void cmGlobalGenerator::CheckTargetProperties()
+void cmGlobalGenerator::CheckLocalGenerators()
{
std::map<std::string, std::string> notFoundMap;
// std::set<std::string> notFoundMap;
@@ -1995,10 +1985,23 @@ void cmGlobalGenerator::EnableInstallTarget()
this->InstallTargetEnabled = true;
}
+cmLocalGenerator *
+cmGlobalGenerator::MakeLocalGenerator(cmState::Snapshot snapshot,
+ cmLocalGenerator *parent)
+{
+ if (!snapshot.IsValid())
+ {
+ snapshot = this->CMakeInstance->GetCurrentSnapshot();
+ }
+
+ return this->CreateLocalGenerator(parent, snapshot);
+}
+
cmLocalGenerator*
-cmGlobalGenerator::CreateLocalGenerator(cmMakefile* mf)
+cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalGenerator(this, mf);
+ return new cmLocalGenerator(this, parent, snapshot);
}
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 4461831..21cbd44 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -56,8 +56,9 @@ public:
cmGlobalGenerator(cmake* cm);
virtual ~cmGlobalGenerator();
- virtual cmLocalGenerator*
- CreateLocalGenerator(cmMakefile* mf);
+ cmLocalGenerator* MakeLocalGenerator(
+ cmState::Snapshot snapshot = cmState::Snapshot(),
+ cmLocalGenerator* parent = 0);
///! Get the name for this generator
virtual std::string GetName() const { return "Generic"; }
@@ -91,7 +92,6 @@ public:
ImportedOnly
};
- void CreateLocalGenerators();
void CreateGenerationObjects(TargetTypes targetTypes = AllTargets);
/**
@@ -395,7 +395,7 @@ protected:
// Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
void FillProjectMap();
- void CheckTargetProperties();
+ void CheckLocalGenerators();
bool IsExcluded(cmState::Snapshot const& root,
cmState::Snapshot const& snp) const;
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
@@ -441,6 +441,10 @@ protected:
virtual bool UseFolderProperty();
private:
+ ///! Create a local generator appropriate to this Global Generator
+ virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
+
cmMakefile* TryCompileOuterMakefile;
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 6dde1e3..f764418 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -33,9 +33,10 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
}
cmLocalGenerator *
-cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmMakefile* mf)
+cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalGhsMultiGenerator(this, mf);
+ return new cmLocalGhsMultiGenerator(this, parent, snapshot);
}
void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry)
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 8f88d4f..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(cmMakefile* mf);
+ 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 120bb03..b92ad32 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -528,9 +528,10 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
// Virtual public methods.
cmLocalGenerator*
-cmGlobalNinjaGenerator::CreateLocalGenerator(cmMakefile* mf)
+cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalNinjaGenerator(this, mf);
+ return new cmLocalNinjaGenerator(this, parent, snapshot);
}
void cmGlobalNinjaGenerator
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index d204a50..f103801 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -162,24 +162,33 @@ public:
public:
cmGlobalNinjaGenerator(cmake* cm);
+ /// Convenience method for creating an instance of this class.
static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>(); }
+ /// Destructor.
virtual ~cmGlobalNinjaGenerator() { }
- virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf);
+ /// Overloaded methods. @see cmGlobalGenerator::CreateLocalGenerator()
+ virtual cmLocalGenerator* CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
+ /// Overloaded methods. @see cmGlobalGenerator::GetName().
virtual std::string GetName() const {
return cmGlobalNinjaGenerator::GetActualName(); }
+ /// @return the name of this generator.
static std::string GetActualName() { return "Ninja"; }
+ /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
static void GetDocumentation(cmDocumentationEntry& entry);
+ /// Overloaded methods. @see cmGlobalGenerator::EnableLanguage()
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile* mf,
bool optional);
+ /// Overloaded methods. @see cmGlobalGenerator::GenerateBuildCommand()
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand,
const std::string& makeProgram,
@@ -298,8 +307,11 @@ public:
protected:
+ /// Overloaded methods. @see cmGlobalGenerator::Generate()
virtual void Generate();
+ /// Overloaded methods.
+ /// @see cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS()
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const { return true; }
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index cf4fd69..605ece2 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -59,10 +59,11 @@ void cmGlobalUnixMakefileGenerator3
}
///! Create a local generator appropriate to this Global Generator
-cmLocalGenerator* cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(
- cmMakefile* mf)
+cmLocalGenerator *
+cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalUnixMakefileGenerator3(this, mf);
+ return new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
}
//----------------------------------------------------------------------------
@@ -577,20 +578,16 @@ void cmGlobalUnixMakefileGenerator3
makeOptions.begin(), makeOptions.end());
if (!targetName.empty())
{
- cmMakefile* mf;
cmLocalUnixMakefileGenerator3 *lg;
if (!this->LocalGenerators.empty())
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->LocalGenerators[0]);
- mf = lg->GetMakefile();
}
else
{
- cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot();
- mf = new cmMakefile(this, snapshot);
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
- (this->CreateLocalGenerator(mf));
+ (this->MakeLocalGenerator());
// set the Start directories
lg->GetMakefile()->SetCurrentSourceDirectory
(this->CMakeInstance->GetHomeDirectory());
@@ -609,7 +606,6 @@ void cmGlobalUnixMakefileGenerator3
if (this->LocalGenerators.empty())
{
delete lg;
- delete mf;
}
}
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 5f39c79..c738c16 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -67,7 +67,9 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
- virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
+ ///! Create a local generator appropriate to this Global Generator3
+ 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 44d632d..8ec4fd9 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -306,10 +306,11 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
}
///! Create a local generator appropriate to this Global Generator
-cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator(
- cmMakefile* mf)
+cmLocalGenerator *
+cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalVisualStudio10Generator(this, mf);
+ return new cmLocalVisualStudio10Generator(this, parent, snapshot);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 8de7b09..3d34a3f 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -48,7 +48,8 @@ public:
virtual bool Compute();
///! create the correct local generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
+ 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 df49948..b7c897c 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(cmMakefile* mf)
+cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalVisualStudio6Generator(this, mf);
+ return new cmLocalVisualStudio6Generator(this, parent, snapshot);
}
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index e9b24ea..420cb0b 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(cmMakefile* mf);
+ 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 0175062..2660d23 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -279,11 +279,12 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
}
///! Create a local generator appropriate to this Global Generator
-cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator(
- cmMakefile* mf)
+cmLocalGenerator *
+cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
cmLocalVisualStudio7Generator *lg =
- new cmLocalVisualStudio7Generator(this, mf);
+ new cmLocalVisualStudio7Generator(this, parent, snapshot);
return lg;
}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 35575d1..931ac9c 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(cmMakefile* mf);
+ 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 33babec..eb547bd 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(cmMakefile* mf)
+cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
{
- return new cmLocalXCodeGenerator(this, mf);
+ return new cmLocalXCodeGenerator(this, parent, snapshot);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 102c036..ee8bf2c 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(cmMakefile *mf);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 2023697..fa29b4f 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -68,9 +68,8 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator ggi(&cm);
- cmsys::auto_ptr<cmMakefile> mf(
- new cmMakefile(&ggi, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(ggi.MakeLocalGenerator());
+ cmMakefile *mf = lg->GetMakefile();
const char* inFileName = settingsFileName;
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 5a18e2f..4583446 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -14,8 +14,9 @@
#include "cmMakefile.h"
cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
- cmMakefile* mf):
- cmLocalGenerator(gg, mf)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot):
+ cmLocalGenerator(gg, parent, snapshot)
{
}
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index 6b4b1cd..af94cda 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -22,7 +22,9 @@ class cmCommonTargetGenerator;
class cmLocalCommonGenerator: public cmLocalGenerator
{
public:
- cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
+ cmLocalCommonGenerator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
~cmLocalCommonGenerator();
std::string const& GetConfigName() { return this->ConfigName; }
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 455b698..7ce4819 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -43,13 +43,15 @@
#endif
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
- cmMakefile* makefile)
- : cmOutputConverter(makefile->GetStateSnapshot()),
- StateSnapshot(makefile->GetStateSnapshot())
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : cmOutputConverter(snapshot), StateSnapshot(snapshot)
{
+ assert(snapshot.IsValid());
this->GlobalGenerator = gg;
+ this->Parent = parent;
- this->Makefile = makefile;
+ this->Makefile = new cmMakefile(this);
this->EmitUniversalBinaryFlags = true;
this->BackwardsCompatibility = 0;
@@ -58,6 +60,7 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
cmLocalGenerator::~cmLocalGenerator()
{
+ delete this->Makefile;
}
void cmLocalGenerator::IssueMessage(cmake::MessageType t,
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 28b5ed1..915814b 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -36,7 +36,8 @@ class cmCustomCommandGenerator;
class cmLocalGenerator : public cmOutputConverter
{
public:
- cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile);
+ cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalGenerator();
/**
@@ -85,6 +86,9 @@ public:
cmState* GetState() const;
cmState::Snapshot GetStateSnapshot() const;
+ ///! set/get the parent generator
+ cmLocalGenerator* GetParent() const {return this->Parent;}
+
void AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
const std::string&lang, const std::string& config);
@@ -339,6 +343,7 @@ protected:
cmMakefile *Makefile;
cmState::Snapshot StateSnapshot;
cmGlobalGenerator *GlobalGenerator;
+ cmLocalGenerator* Parent;
std::map<std::string, std::string> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
std::set<std::string> ObjectMaxPathViolations;
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index bac989f..8e498dd 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -17,8 +17,9 @@
#include "cmGeneratedFileStream.h"
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
- cmMakefile* mf)
- : cmLocalGenerator(gg, mf)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : cmLocalGenerator(gg, parent, snapshot)
{
}
diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h
index b6a9a33..f52ef39 100644
--- a/Source/cmLocalGhsMultiGenerator.h
+++ b/Source/cmLocalGhsMultiGenerator.h
@@ -25,7 +25,8 @@ class cmGeneratedFileStream;
class cmLocalGhsMultiGenerator : public cmLocalGenerator
{
public:
- cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
+ cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalGhsMultiGenerator();
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 7525bf2..cfca418 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -23,8 +23,9 @@
#include <assert.h>
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
- cmMakefile* mf)
- : cmLocalCommonGenerator(gg, mf)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : cmLocalCommonGenerator(gg, parent, snapshot)
, HomeRelativeOutputPath("")
{
this->TargetImplib = "$TARGET_IMPLIB";
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 8d3d49c..d10be0c 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -31,7 +31,8 @@ class cmake;
class cmLocalNinjaGenerator : public cmLocalCommonGenerator
{
public:
- cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
+ cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalNinjaGenerator();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index b131a63..589105e 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, cmMakefile* mf)
- : cmLocalCommonGenerator(gg, mf)
+cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : cmLocalCommonGenerator(gg, parent, snapshot)
{
this->MakefileVariableSize = 0;
this->ColorMakefile = false;
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 98f15e6..01ac01b 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -34,7 +34,9 @@ class cmSourceFile;
class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator
{
public:
- cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf);
+ cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalUnixMakefileGenerator3();
virtual void ComputeHomeRelativeOutputPath();
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index b043b00..9e3185c 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -62,8 +62,10 @@ class cmVS10XMLParser : public cmXMLParser
//----------------------------------------------------------------------------
cmLocalVisualStudio10Generator
-::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf):
- cmLocalVisualStudio7Generator(gg, mf)
+::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot):
+ cmLocalVisualStudio7Generator(gg, parent, snapshot)
{
}
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index e187590..c588aaf 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -25,7 +25,9 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf);
+ cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudio10Generator();
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index cc94cd4..3a44367 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -24,8 +24,10 @@
#include <cmsys/FStream.hxx>
cmLocalVisualStudio6Generator
-::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmMakefile* mf):
- cmLocalVisualStudioGenerator(gg, mf)
+::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot):
+ cmLocalVisualStudioGenerator(gg, parent, snapshot)
{
}
diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h
index 828d252..a44e61d 100644
--- a/Source/cmLocalVisualStudio6Generator.h
+++ b/Source/cmLocalVisualStudio6Generator.h
@@ -29,7 +29,9 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmMakefile* mf);
+ cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudio6Generator();
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index cf67251..55ad852 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -53,8 +53,10 @@ static void cmConvertToWindowsSlash(std::string& s)
//----------------------------------------------------------------------------
cmLocalVisualStudio7Generator
-::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf):
- cmLocalVisualStudioGenerator(gg, mf)
+::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
+ 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 bc05a06..43f3af9 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -35,7 +35,9 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf);
+ cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalVisualStudio7Generator();
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index c0072de..3588853 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -19,8 +19,10 @@
//----------------------------------------------------------------------------
cmLocalVisualStudioGenerator
-::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf)
- : cmLocalGenerator(gg, mf)
+::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : cmLocalGenerator(gg, parent, snapshot)
{
}
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 071bfb3..d414651 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -31,7 +31,9 @@ class cmCustomCommandGenerator;
class cmLocalVisualStudioGenerator : public cmLocalGenerator
{
public:
- cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
+ cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
+ 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 b19112d..804dd7d 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -16,8 +16,9 @@
//----------------------------------------------------------------------------
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
- cmMakefile* mf)
- : cmLocalGenerator(gg, mf)
+ 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 6d0926f..26fff9c 100644
--- a/Source/cmLocalXCodeGenerator.h
+++ b/Source/cmLocalXCodeGenerator.h
@@ -24,8 +24,8 @@ class cmLocalXCodeGenerator : public cmLocalGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalXCodeGenerator(cmGlobalGenerator* gg,
- cmMakefile* mf);
+ 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 6480667..4a4663a 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -16,6 +16,7 @@
#include "cmSourceFileLocation.h"
#include "cmSystemTools.h"
#include "cmGlobalGenerator.h"
+#include "cmLocalGenerator.h"
#include "cmCommands.h"
#include "cmState.h"
#include "cmOutputConverter.h"
@@ -43,10 +44,9 @@
#include <assert.h>
// default is not to be building executables
-cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
- cmState::Snapshot const& snapshot)
- : GlobalGenerator(globalGenerator),
- StateSnapshot(snapshot)
+cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
+ : LocalGenerator(localGenerator),
+ StateSnapshot(localGenerator->GetStateSnapshot())
{
this->IsSourceFileTryCompile = false;
@@ -1753,8 +1753,13 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
this->ContextStack.back()->Name,
this->ContextStack.back()->Line);
- cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot);
- this->GetGlobalGenerator()->AddMakefile(subMf);
+ // create a new local generator and set its parent
+ cmLocalGenerator *lg2 = this->GetGlobalGenerator()
+ ->MakeLocalGenerator(newSnapshot, this->LocalGenerator);
+ this->GetGlobalGenerator()->AddMakefile(lg2->GetMakefile());
+ this->GetGlobalGenerator()->AddLocalGenerator(lg2);
+
+ cmMakefile* subMf = lg2->GetMakefile();
// set the subdirs start dirs
subMf->SetCurrentSourceDirectory(srcPath);
@@ -2329,8 +2334,7 @@ void cmMakefile::ExpandVariablesCMP0019()
l != this->Targets.end(); ++l)
{
cmTarget &t = l->second;
- if (t.GetType() == cmTarget::INTERFACE_LIBRARY
- || t.GetType() == cmTarget::GLOBAL_TARGET)
+ if (t.GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
}
@@ -3740,12 +3744,12 @@ bool cmMakefile::GetIsSourceFileTryCompile() const
cmake *cmMakefile::GetCMakeInstance() const
{
- return this->GlobalGenerator->GetCMakeInstance();
+ return this->GetGlobalGenerator()->GetCMakeInstance();
}
cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const
{
- return this->GlobalGenerator;
+ return this->LocalGenerator->GetGlobalGenerator();
}
#ifdef CMAKE_BUILD_WITH_CMAKE
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 3cf20a6..f3839aa 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -42,6 +42,7 @@
class cmFunctionBlocker;
class cmCommand;
class cmInstallGenerator;
+class cmLocalGenerator;
class cmMakeDepend;
class cmSourceFile;
class cmTest;
@@ -70,8 +71,7 @@ public:
/**
* Construct an empty makefile.
*/
- cmMakefile(cmGlobalGenerator* globalGenerator,
- const cmState::Snapshot& snapshot);
+ cmMakefile(cmLocalGenerator* localGenerator);
/**
* Destructor.
@@ -856,7 +856,7 @@ protected:
#endif
std::vector<cmCommand*> FinalPassCommands;
- cmGlobalGenerator* GlobalGenerator;
+ cmLocalGenerator* LocalGenerator;
bool IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus &status);
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index becfeba..0a4b546 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1217,9 +1217,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cm.SetHomeDirectory(targetDirectory);
cmGlobalGenerator gg(&cm);
- cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, snapshot));
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
+ cmLocalGenerator* lg = gg.MakeLocalGenerator();
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
gg.SetCurrentMakefile(lg->GetMakefile());
@@ -1236,6 +1234,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
this->WriteOldMocDefinitionsFile(targetDirectory);
+ delete lg;
return success;
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index f069481..1f5c4d4 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -429,9 +429,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
std::string homeOutputDir = this->GetHomeOutputDirectory();
this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- cmState::Snapshot snapshot = this->GetCurrentSnapshot();
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
- cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator());
lg->GetMakefile()->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
lg->GetMakefile()->SetCurrentSourceDirectory
@@ -471,10 +469,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
cmGlobalGenerator *gg = new cmGlobalGenerator(this);
this->SetGlobalGenerator(gg);
- cmState::Snapshot snapshot = this->GetCurrentSnapshot();
// read in the list file to fill the cache
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
- cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator());
+ cmMakefile* mf = lg->GetMakefile();
mf->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
mf->SetCurrentSourceDirectory
@@ -2062,8 +2059,8 @@ int cmake::CheckBuildSystem()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
+ cmMakefile* mf = lg->GetMakefile();
if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
{
@@ -2092,11 +2089,8 @@ int cmake::CheckBuildSystem()
ggd(this->CreateGlobalGenerator(genName));
if(ggd.get())
{
- cmsys::auto_ptr<cmMakefile> mfd(new cmMakefile(ggd.get(),
- cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lgd(
- ggd->CreateLocalGenerator(mfd.get()));
- lgd->ClearDependencies(mfd.get(), verbose);
+ cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator());
+ lgd->ClearDependencies(mf, verbose);
}
}
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index aa70aa0..7bee0ea 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -768,10 +768,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen))
{
cm.SetGlobalGenerator(ggd);
- cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
- cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(ggd, snapshot));
- cmsys::auto_ptr<cmLocalGenerator> lgd(
- ggd->CreateLocalGenerator(mf.get()));
+ cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator());
lgd->GetMakefile()->SetCurrentSourceDirectory(startDir);
lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir);
-----------------------------------------------------------------------
Summary of changes:
Source/CPack/cmCPackGenerator.cxx | 6 +-
Source/CPack/cpack.cxx | 10 ++-
Source/CTest/cmCTestLaunch.cxx | 5 +-
Source/CTest/cmCTestScriptHandler.cxx | 45 +++++++++-----
Source/CTest/cmCTestTestHandler.cxx | 5 +-
Source/cmCTest.cxx | 7 +--
Source/cmGlobalBorlandMakefileGenerator.cxx | 4 +-
Source/cmGlobalBorlandMakefileGenerator.h | 3 +-
Source/cmGlobalGenerator.cxx | 87 ++++++++++++++-------------
Source/cmGlobalGenerator.h | 12 ++--
Source/cmGlobalGhsMultiGenerator.cxx | 5 +-
Source/cmGlobalGhsMultiGenerator.h | 3 +-
Source/cmGlobalNinjaGenerator.cxx | 5 +-
Source/cmGlobalNinjaGenerator.h | 14 ++++-
Source/cmGlobalUnixMakefileGenerator3.cxx | 14 ++---
Source/cmGlobalUnixMakefileGenerator3.h | 4 +-
Source/cmGlobalVisualStudio10Generator.cxx | 7 ++-
Source/cmGlobalVisualStudio10Generator.h | 3 +-
Source/cmGlobalVisualStudio6Generator.cxx | 5 +-
Source/cmGlobalVisualStudio6Generator.h | 3 +-
Source/cmGlobalVisualStudio7Generator.cxx | 7 ++-
Source/cmGlobalVisualStudio7Generator.h | 3 +-
Source/cmGlobalXCodeGenerator.cxx | 5 +-
Source/cmGlobalXCodeGenerator.h | 3 +-
Source/cmGraphVizWriter.cxx | 5 +-
Source/cmLocalCommonGenerator.cxx | 5 +-
Source/cmLocalCommonGenerator.h | 4 +-
Source/cmLocalGenerator.cxx | 11 ++--
Source/cmLocalGenerator.h | 7 ++-
Source/cmLocalGhsMultiGenerator.cxx | 5 +-
Source/cmLocalGhsMultiGenerator.h | 3 +-
Source/cmLocalNinjaGenerator.cxx | 5 +-
Source/cmLocalNinjaGenerator.h | 3 +-
Source/cmLocalUnixMakefileGenerator3.cxx | 5 +-
Source/cmLocalUnixMakefileGenerator3.h | 4 +-
Source/cmLocalVisualStudio10Generator.cxx | 6 +-
Source/cmLocalVisualStudio10Generator.h | 4 +-
Source/cmLocalVisualStudio6Generator.cxx | 6 +-
Source/cmLocalVisualStudio6Generator.h | 4 +-
Source/cmLocalVisualStudio7Generator.cxx | 6 +-
Source/cmLocalVisualStudio7Generator.h | 4 +-
Source/cmLocalVisualStudioGenerator.cxx | 6 +-
Source/cmLocalVisualStudioGenerator.h | 4 +-
Source/cmLocalXCodeGenerator.cxx | 5 +-
Source/cmLocalXCodeGenerator.h | 4 +-
Source/cmMakefile.cxx | 24 +++++---
Source/cmMakefile.h | 6 +-
Source/cmQtAutoGenerators.cxx | 5 +-
Source/cmake.cxx | 20 +++---
Source/cmcmd.cxx | 5 +-
50 files changed, 247 insertions(+), 184 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list