summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-08-31 13:48:28 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-08-31 13:48:28 (GMT)
commit352e8e95b65e19cca10b4aec0c626787dfbb1ba1 (patch)
tree936261c46c550e734a5b8faab5623c1121b2b9e0 /Source
parent97db5c567894c253173ab45c919925ce010ab05e (diff)
parent2b9a25d7f723a9876e2979de8e6c06881e0312dc (diff)
downloadCMake-352e8e95b65e19cca10b4aec0c626787dfbb1ba1.zip
CMake-352e8e95b65e19cca10b4aec0c626787dfbb1ba1.tar.gz
CMake-352e8e95b65e19cca10b4aec0c626787dfbb1ba1.tar.bz2
Merge topic 'generate-time-generators'
2b9a25d7 cmGlobalGenerator: Create global targets directly after Configure. 3e08b4df cmMakefile: Skip Global targets for CMP0019 evaluation. 357bf469 cmGlobalGenerator: Fill the project map at compute time. ebf8d0a9 cmGlobalGenerator: Rename method. bd096d30 cmGlobalGenerator: Avoid cmLocalGenerator until after Configure. ff8ac8ee cmLocalGenerator: Create from already-constructed cmMakefile. 0bd7279f Ninja: Remove some incorrect comments adding no value. 2f2d4da9 cmCTestScriptHandler: Simplify deletes. 7fdc9a8b QtAutogen: Use a smart pointer. 92041eec cmGlobalGenerator: Remove MakeLocalGenerator method. acb00622 cmGlobalGenerator: Require a snapshot to create a local generator. 83b8a927 cmMakefile: Remove cmLocalGenerator member. 9b6a743b cmLocalGenerator: Remove Parent pointer.
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cmCPackGenerator.cxx6
-rw-r--r--Source/CPack/cpack.cxx10
-rw-r--r--Source/CTest/cmCTestLaunch.cxx5
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx46
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx5
-rw-r--r--Source/cmCTest.cxx7
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx4
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.h3
-rw-r--r--Source/cmGlobalGenerator.cxx80
-rw-r--r--Source/cmGlobalGenerator.h11
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx5
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h3
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx5
-rw-r--r--Source/cmGlobalNinjaGenerator.h14
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx14
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h4
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmGlobalXCodeGenerator.h3
-rw-r--r--Source/cmGraphVizWriter.cxx5
-rw-r--r--Source/cmLocalCommonGenerator.cxx5
-rw-r--r--Source/cmLocalCommonGenerator.h4
-rw-r--r--Source/cmLocalGenerator.cxx11
-rw-r--r--Source/cmLocalGenerator.h7
-rw-r--r--Source/cmLocalGhsMultiGenerator.cxx5
-rw-r--r--Source/cmLocalGhsMultiGenerator.h3
-rw-r--r--Source/cmLocalNinjaGenerator.cxx5
-rw-r--r--Source/cmLocalNinjaGenerator.h3
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h4
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx6
-rw-r--r--Source/cmLocalVisualStudio10Generator.h4
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx6
-rw-r--r--Source/cmLocalVisualStudio6Generator.h4
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx6
-rw-r--r--Source/cmLocalVisualStudio7Generator.h4
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx6
-rw-r--r--Source/cmLocalVisualStudioGenerator.h4
-rw-r--r--Source/cmLocalXCodeGenerator.cxx5
-rw-r--r--Source/cmLocalXCodeGenerator.h4
-rw-r--r--Source/cmMakefile.cxx23
-rw-r--r--Source/cmMakefile.h6
-rw-r--r--Source/cmQtAutoGenerators.cxx5
-rw-r--r--Source/cmake.cxx20
-rw-r--r--Source/cmcmd.cxx5
50 files changed, 176 insertions, 247 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index bf4df60..92a4b2b 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -716,8 +716,10 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.AddCMakePaths();
cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
- cmMakefile *mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(
+ new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(
+ gg.CreateLocalGenerator(mf.get()));
std::string realInstallDirectory = tempInstallDirectory;
if ( !installSubDirectory.empty() && installSubDirectory != "/" )
{
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index c2fe763..cb9cbc4 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -202,8 +202,10 @@ int main (int argc, char const* const* argv)
cminst.SetHomeOutputDirectory("");
cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg(&cminst);
- cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.MakeLocalGenerator());
- cmMakefile* globalMF = cmlg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> globalMF(
+ new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> cmlg(
+ cmgg.CreateLocalGenerator(globalMF.get()));
#if defined(__CYGWIN__)
globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");
#endif
@@ -357,8 +359,8 @@ int main (int argc, char const* const* argv)
++it )
{
const char* gen = it->c_str();
- cmMakefile::ScopePushPop raii(globalMF);
- cmMakefile* mf = globalMF;
+ cmMakefile::ScopePushPop raii(globalMF.get());
+ cmMakefile* mf = globalMF.get();
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 0f588c5..fb0cce6 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -738,8 +738,9 @@ void cmCTestLaunch::LoadConfig()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
- cmMakefile* mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(
+ gg.CreateLocalGenerator(mf.get()));
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 047bd98..c1ba279 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -125,42 +125,25 @@ void cmCTestScriptHandler::Initialize()
// what time in seconds did this script start running
this->ScriptStartTime = 0;
+ delete this->Makefile;
this->Makefile = 0;
- if (this->LocalGenerator)
- {
- delete this->LocalGenerator;
- }
+
+ delete this->LocalGenerator;
this->LocalGenerator = 0;
- if (this->GlobalGenerator)
- {
- delete this->GlobalGenerator;
- }
+
+ delete this->GlobalGenerator;
this->GlobalGenerator = 0;
- if (this->CMake)
- {
- delete this->CMake;
- }
+
+ delete this->CMake;
}
//----------------------------------------------------------------------
cmCTestScriptHandler::~cmCTestScriptHandler()
{
- // 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;
- }
+ delete this->Makefile;
+ delete this->LocalGenerator;
+ delete this->GlobalGenerator;
+ delete this->CMake;
}
@@ -334,6 +317,7 @@ void cmCTestScriptHandler::CreateCMake()
delete this->CMake;
delete this->GlobalGenerator;
delete this->LocalGenerator;
+ delete this->Makefile;
}
this->CMake = new cmake;
this->CMake->SetHomeDirectory("");
@@ -341,8 +325,10 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->AddCMakePaths();
this->GlobalGenerator = new cmGlobalGenerator(this->CMake);
- this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator();
- this->Makefile = this->LocalGenerator->GetMakefile();
+ cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot();
+ this->Makefile = new cmMakefile(this->GlobalGenerator, snapshot);
+ this->LocalGenerator =
+ this->GlobalGenerator->CreateLocalGenerator(this->Makefile);
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index c8a0d27..a523f57 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1592,8 +1592,9 @@ void cmCTestTestHandler::GetListOfTests()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
- cmMakefile *mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(
+ gg.CreateLocalGenerator(mf.get()));
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str());
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index b976469..adefd1c 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -520,9 +520,10 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
- cmMakefile *mf = lg->GetMakefile();
- if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )
+ 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()) )
{
cmCTestOptionalLog(this, DEBUG,
"Cannot find custom configuration file tree" << std::endl, quiet);
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 87665a0..40e8d29 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -44,10 +44,10 @@ void cmGlobalBorlandMakefileGenerator
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(
- cmLocalGenerator* parent, cmState::Snapshot snapshot)
+ cmMakefile *mf)
{
cmLocalUnixMakefileGenerator3* lg =
- new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
+ new cmLocalUnixMakefileGenerator3(this, mf);
lg->SetMakefileVariableSize(32);
lg->SetMakeCommandEscapeTargetTwice(true);
lg->SetBorlandMakeCurlyHack(true);
diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h
index 2ec510d..b59c86d 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.h
+++ b/Source/cmGlobalBorlandMakefileGenerator.h
@@ -36,8 +36,7 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 46c1ccc..b3f3cba 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1127,23 +1127,40 @@ void cmGlobalGenerator::Configure()
this->FirstTimeProgress = 0.0f;
this->ClearGeneratorMembers();
- // start with this directory
- cmLocalGenerator *lg = this->MakeLocalGenerator();
- this->Makefiles.push_back(lg->GetMakefile());
+ cmMakefile* dirMf =
+ new cmMakefile(this, this->GetCMakeInstance()->GetCurrentSnapshot());
+ this->Makefiles.push_back(dirMf);
+ cmLocalGenerator *lg = this->CreateLocalGenerator(dirMf);
this->LocalGenerators.push_back(lg);
// set the Start directories
- lg->GetMakefile()->SetCurrentSourceDirectory
+ dirMf->SetCurrentSourceDirectory
(this->CMakeInstance->GetHomeDirectory());
- lg->GetMakefile()->SetCurrentBinaryDirectory
+ dirMf->SetCurrentBinaryDirectory
(this->CMakeInstance->GetHomeOutputDirectory());
this->BinaryDirectories.insert(
this->CMakeInstance->GetHomeOutputDirectory());
// now do it
- lg->GetMakefile()->Configure();
- lg->GetMakefile()->EnforceDirectoryLevelRules();
+ 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);
+ }
+ }
// update the cache entry for the number of local generators, this is used
// for progress
@@ -1155,11 +1172,7 @@ void cmGlobalGenerator::Configure()
// check for link libraries and include directories containing "NOTFOUND"
// and for infinite loops
- this->CheckLocalGenerators();
-
- // at this point this->LocalGenerators has been filled,
- // so create the map from project name to vector of local generators
- this->FillProjectMap();
+ this->CheckTargetProperties();
if ( this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE)
{
@@ -1186,25 +1199,6 @@ void cmGlobalGenerator::Configure()
}
this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1);
}
-
- 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)
- {
- 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)
@@ -1267,6 +1261,10 @@ 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
@@ -1600,6 +1598,7 @@ void cmGlobalGenerator::ClearGeneratorMembers()
cmDeleteAll(this->BuildExportSets);
this->BuildExportSets.clear();
+ cmDeleteAll(this->Makefiles);
this->Makefiles.clear();
cmDeleteAll(this->LocalGenerators);
@@ -1634,7 +1633,7 @@ void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
{
}
-void cmGlobalGenerator::CheckLocalGenerators()
+void cmGlobalGenerator::CheckTargetProperties()
{
std::map<std::string, std::string> notFoundMap;
// std::set<std::string> notFoundMap;
@@ -1985,23 +1984,10 @@ 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(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmGlobalGenerator::CreateLocalGenerator(cmMakefile* mf)
{
- return new cmLocalGenerator(this, parent, snapshot);
+ return new cmLocalGenerator(this, mf);
}
void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 21cbd44..9fc2d45 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -56,9 +56,8 @@ public:
cmGlobalGenerator(cmake* cm);
virtual ~cmGlobalGenerator();
- cmLocalGenerator* MakeLocalGenerator(
- cmState::Snapshot snapshot = cmState::Snapshot(),
- cmLocalGenerator* parent = 0);
+ virtual cmLocalGenerator*
+ CreateLocalGenerator(cmMakefile* mf);
///! Get the name for this generator
virtual std::string GetName() const { return "Generic"; }
@@ -395,7 +394,7 @@ protected:
// Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
void FillProjectMap();
- void CheckLocalGenerators();
+ void CheckTargetProperties();
bool IsExcluded(cmState::Snapshot const& root,
cmState::Snapshot const& snp) const;
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
@@ -441,10 +440,6 @@ 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 f764418..6dde1e3 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -33,10 +33,9 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
}
cmLocalGenerator *
-cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmMakefile* mf)
{
- return new cmLocalGhsMultiGenerator(this, parent, snapshot);
+ return new cmLocalGhsMultiGenerator(this, mf);
}
void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry)
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index f1a3ed7..8f88d4f 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -31,8 +31,7 @@ public:
{ return new cmGlobalGeneratorSimpleFactory<cmGlobalGhsMultiGenerator>(); }
///! create the correct local generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/// @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 b92ad32..120bb03 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -528,10 +528,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
// Virtual public methods.
cmLocalGenerator*
-cmGlobalNinjaGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmGlobalNinjaGenerator::CreateLocalGenerator(cmMakefile* mf)
{
- return new cmLocalNinjaGenerator(this, parent, snapshot);
+ return new cmLocalNinjaGenerator(this, mf);
}
void cmGlobalNinjaGenerator
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index f103801..d204a50 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -162,33 +162,24 @@ public:
public:
cmGlobalNinjaGenerator(cmake* cm);
- /// Convenience method for creating an instance of this class.
static cmGlobalGeneratorFactory* NewFactory() {
return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>(); }
- /// Destructor.
virtual ~cmGlobalNinjaGenerator() { }
- /// Overloaded methods. @see cmGlobalGenerator::CreateLocalGenerator()
- virtual cmLocalGenerator* CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf);
- /// 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,
@@ -307,11 +298,8 @@ 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 605ece2..cf4fd69 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -59,11 +59,10 @@ void cmGlobalUnixMakefileGenerator3
}
///! Create a local generator appropriate to this Global Generator
-cmLocalGenerator *
-cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmLocalGenerator* cmGlobalUnixMakefileGenerator3::CreateLocalGenerator(
+ cmMakefile* mf)
{
- return new cmLocalUnixMakefileGenerator3(this, parent, snapshot);
+ return new cmLocalUnixMakefileGenerator3(this, mf);
}
//----------------------------------------------------------------------------
@@ -578,16 +577,20 @@ 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->MakeLocalGenerator());
+ (this->CreateLocalGenerator(mf));
// set the Start directories
lg->GetMakefile()->SetCurrentSourceDirectory
(this->CMakeInstance->GetHomeDirectory());
@@ -606,6 +609,7 @@ void cmGlobalUnixMakefileGenerator3
if (this->LocalGenerators.empty())
{
delete lg;
+ delete mf;
}
}
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index c738c16..5f39c79 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -67,9 +67,7 @@ public:
/** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry);
- ///! Create a local generator appropriate to this Global Generator3
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 8ec4fd9..44d632d 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -306,11 +306,10 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
}
///! Create a local generator appropriate to this Global Generator
-cmLocalGenerator *
-cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator(
+ cmMakefile* mf)
{
- return new cmLocalVisualStudio10Generator(this, parent, snapshot);
+ return new cmLocalVisualStudio10Generator(this, mf);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 3d34a3f..8de7b09 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -48,8 +48,7 @@ public:
virtual bool Compute();
///! create the correct local generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index b7c897c..df49948 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -173,10 +173,9 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
-cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmMakefile* mf)
{
- return new cmLocalVisualStudio6Generator(this, parent, snapshot);
+ return new cmLocalVisualStudio6Generator(this, mf);
}
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 420cb0b..e9b24ea 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -39,8 +39,7 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 2660d23..0175062 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -279,12 +279,11 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
}
///! Create a local generator appropriate to this Global Generator
-cmLocalGenerator *
-cmGlobalVisualStudio7Generator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator(
+ cmMakefile* mf)
{
cmLocalVisualStudio7Generator *lg =
- new cmLocalVisualStudio7Generator(this, parent, snapshot);
+ new cmLocalVisualStudio7Generator(this, mf);
return lg;
}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 931ac9c..35575d1 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -43,8 +43,7 @@ public:
std::string const& GetPlatformName() const;
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index eb547bd..33babec 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -371,10 +371,9 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
//----------------------------------------------------------------------------
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *
-cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
+cmGlobalXCodeGenerator::CreateLocalGenerator(cmMakefile* mf)
{
- return new cmLocalXCodeGenerator(this, parent, snapshot);
+ return new cmLocalXCodeGenerator(this, mf);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index ee8bf2c..102c036 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -41,8 +41,7 @@ public:
static void GetDocumentation(cmDocumentationEntry& entry);
///! Create a local generator appropriate to this Global Generator
- virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile *mf);
/**
* Try to determine system information such as shared library
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index fa29b4f..2023697 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -68,8 +68,9 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator ggi(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(ggi.MakeLocalGenerator());
- cmMakefile *mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(
+ new cmMakefile(&ggi, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get()));
const char* inFileName = settingsFileName;
diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 4583446..5a18e2f 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -14,9 +14,8 @@
#include "cmMakefile.h"
cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot):
- cmLocalGenerator(gg, parent, snapshot)
+ cmMakefile* mf):
+ cmLocalGenerator(gg, mf)
{
}
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index af94cda..6b4b1cd 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -22,9 +22,7 @@ class cmCommonTargetGenerator;
class cmLocalCommonGenerator: public cmLocalGenerator
{
public:
- cmLocalCommonGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
~cmLocalCommonGenerator();
std::string const& GetConfigName() { return this->ConfigName; }
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 7ce4819..455b698 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -43,15 +43,13 @@
#endif
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmOutputConverter(snapshot), StateSnapshot(snapshot)
+ cmMakefile* makefile)
+ : cmOutputConverter(makefile->GetStateSnapshot()),
+ StateSnapshot(makefile->GetStateSnapshot())
{
- assert(snapshot.IsValid());
this->GlobalGenerator = gg;
- this->Parent = parent;
- this->Makefile = new cmMakefile(this);
+ this->Makefile = makefile;
this->EmitUniversalBinaryFlags = true;
this->BackwardsCompatibility = 0;
@@ -60,7 +58,6 @@ 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 915814b..28b5ed1 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -36,8 +36,7 @@ class cmCustomCommandGenerator;
class cmLocalGenerator : public cmOutputConverter
{
public:
- cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile);
virtual ~cmLocalGenerator();
/**
@@ -86,9 +85,6 @@ 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);
@@ -343,7 +339,6 @@ 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 8e498dd..bac989f 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -17,9 +17,8 @@
#include "cmGeneratedFileStream.h"
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmLocalGenerator(gg, parent, snapshot)
+ cmMakefile* mf)
+ : cmLocalGenerator(gg, mf)
{
}
diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h
index f52ef39..b6a9a33 100644
--- a/Source/cmLocalGhsMultiGenerator.h
+++ b/Source/cmLocalGhsMultiGenerator.h
@@ -25,8 +25,7 @@ class cmGeneratedFileStream;
class cmLocalGhsMultiGenerator : public cmLocalGenerator
{
public:
- cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalGhsMultiGenerator();
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index cfca418..7525bf2 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -23,9 +23,8 @@
#include <assert.h>
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmLocalCommonGenerator(gg, parent, snapshot)
+ cmMakefile* mf)
+ : cmLocalCommonGenerator(gg, mf)
, HomeRelativeOutputPath("")
{
this->TargetImplib = "$TARGET_IMPLIB";
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index d10be0c..8d3d49c 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -31,8 +31,7 @@ class cmake;
class cmLocalNinjaGenerator : public cmLocalCommonGenerator
{
public:
- cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalNinjaGenerator();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 589105e..b131a63 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -80,9 +80,8 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
//----------------------------------------------------------------------------
cmLocalUnixMakefileGenerator3::
-cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmLocalCommonGenerator(gg, parent, snapshot)
+cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf)
+ : cmLocalCommonGenerator(gg, mf)
{
this->MakefileVariableSize = 0;
this->ColorMakefile = false;
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 01ac01b..98f15e6 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -34,9 +34,7 @@ class cmSourceFile;
class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator
{
public:
- cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalUnixMakefileGenerator3();
virtual void ComputeHomeRelativeOutputPath();
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 9e3185c..b043b00 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -62,10 +62,8 @@ class cmVS10XMLParser : public cmXMLParser
//----------------------------------------------------------------------------
cmLocalVisualStudio10Generator
-::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot):
- cmLocalVisualStudio7Generator(gg, parent, snapshot)
+::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf):
+ cmLocalVisualStudio7Generator(gg, mf)
{
}
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index c588aaf..e187590 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -25,9 +25,7 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio10Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudio10Generator();
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 3a44367..cc94cd4 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -24,10 +24,8 @@
#include <cmsys/FStream.hxx>
cmLocalVisualStudio6Generator
-::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot):
- cmLocalVisualStudioGenerator(gg, parent, snapshot)
+::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmMakefile* mf):
+ cmLocalVisualStudioGenerator(gg, mf)
{
}
diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h
index a44e61d..828d252 100644
--- a/Source/cmLocalVisualStudio6Generator.h
+++ b/Source/cmLocalVisualStudio6Generator.h
@@ -29,9 +29,7 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio6Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudio6Generator();
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 55ad852..cf67251 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -53,10 +53,8 @@ static void cmConvertToWindowsSlash(std::string& s)
//----------------------------------------------------------------------------
cmLocalVisualStudio7Generator
-::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot):
- cmLocalVisualStudioGenerator(gg, parent, snapshot)
+::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf):
+ cmLocalVisualStudioGenerator(gg, mf)
{
this->Internal = new cmLocalVisualStudio7GeneratorInternals(this);
}
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 43f3af9..bc05a06 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -35,9 +35,7 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator
{
public:
///! Set cache only and recurse to false by default.
- cmLocalVisualStudio7Generator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudio7Generator();
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 3588853..c0072de 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -19,10 +19,8 @@
//----------------------------------------------------------------------------
cmLocalVisualStudioGenerator
-::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmLocalGenerator(gg, parent, snapshot)
+::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf)
+ : cmLocalGenerator(gg, mf)
{
}
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index d414651..071bfb3 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -31,9 +31,7 @@ class cmCustomCommandGenerator;
class cmLocalVisualStudioGenerator : public cmLocalGenerator
{
public:
- cmLocalVisualStudioGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
virtual ~cmLocalVisualStudioGenerator();
/** Construct a script from the given list of command lines. */
diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx
index 804dd7d..b19112d 100644
--- a/Source/cmLocalXCodeGenerator.cxx
+++ b/Source/cmLocalXCodeGenerator.cxx
@@ -16,9 +16,8 @@
//----------------------------------------------------------------------------
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent,
- cmState::Snapshot snapshot)
- : cmLocalGenerator(gg, parent, snapshot)
+ cmMakefile* mf)
+ : cmLocalGenerator(gg, mf)
{
// 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 26fff9c..6d0926f 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, cmLocalGenerator* parent,
- cmState::Snapshot snapshot);
+ cmLocalXCodeGenerator(cmGlobalGenerator* gg,
+ cmMakefile* mf);
virtual ~cmLocalXCodeGenerator();
virtual std::string GetTargetDirectory(cmTarget const& target) const;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4a4663a..8a3d197 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -16,7 +16,6 @@
#include "cmSourceFileLocation.h"
#include "cmSystemTools.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmCommands.h"
#include "cmState.h"
#include "cmOutputConverter.h"
@@ -44,9 +43,10 @@
#include <assert.h>
// default is not to be building executables
-cmMakefile::cmMakefile(cmLocalGenerator* localGenerator)
- : LocalGenerator(localGenerator),
- StateSnapshot(localGenerator->GetStateSnapshot())
+cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
+ cmState::Snapshot const& snapshot)
+ : GlobalGenerator(globalGenerator),
+ StateSnapshot(snapshot)
{
this->IsSourceFileTryCompile = false;
@@ -1753,14 +1753,14 @@ 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());
+ ->CreateLocalGenerator(subMf);
this->GetGlobalGenerator()->AddLocalGenerator(lg2);
- cmMakefile* subMf = lg2->GetMakefile();
-
// set the subdirs start dirs
subMf->SetCurrentSourceDirectory(srcPath);
subMf->SetCurrentBinaryDirectory(binPath);
@@ -2334,7 +2334,8 @@ void cmMakefile::ExpandVariablesCMP0019()
l != this->Targets.end(); ++l)
{
cmTarget &t = l->second;
- if (t.GetType() == cmTarget::INTERFACE_LIBRARY)
+ if (t.GetType() == cmTarget::INTERFACE_LIBRARY
+ || t.GetType() == cmTarget::GLOBAL_TARGET)
{
continue;
}
@@ -3744,12 +3745,12 @@ bool cmMakefile::GetIsSourceFileTryCompile() const
cmake *cmMakefile::GetCMakeInstance() const
{
- return this->GetGlobalGenerator()->GetCMakeInstance();
+ return this->GlobalGenerator->GetCMakeInstance();
}
cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const
{
- return this->LocalGenerator->GetGlobalGenerator();
+ return this->GlobalGenerator;
}
#ifdef CMAKE_BUILD_WITH_CMAKE
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index f3839aa..3cf20a6 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -42,7 +42,6 @@
class cmFunctionBlocker;
class cmCommand;
class cmInstallGenerator;
-class cmLocalGenerator;
class cmMakeDepend;
class cmSourceFile;
class cmTest;
@@ -71,7 +70,8 @@ public:
/**
* Construct an empty makefile.
*/
- cmMakefile(cmLocalGenerator* localGenerator);
+ cmMakefile(cmGlobalGenerator* globalGenerator,
+ const cmState::Snapshot& snapshot);
/**
* Destructor.
@@ -856,7 +856,7 @@ protected:
#endif
std::vector<cmCommand*> FinalPassCommands;
- cmLocalGenerator* LocalGenerator;
+ cmGlobalGenerator* GlobalGenerator;
bool IsFunctionBlocked(const cmListFileFunction& lff,
cmExecutionStatus &status);
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 0a4b546..becfeba 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1217,7 +1217,9 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
cm.SetHomeDirectory(targetDirectory);
cmGlobalGenerator gg(&cm);
- cmLocalGenerator* lg = gg.MakeLocalGenerator();
+ cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, snapshot));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
gg.SetCurrentMakefile(lg->GetMakefile());
@@ -1234,7 +1236,6 @@ 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 1f5c4d4..f069481 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -429,7 +429,9 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
std::string homeOutputDir = this->GetHomeOutputDirectory();
this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
- cmsys::auto_ptr<cmLocalGenerator> lg(gg->MakeLocalGenerator());
+ cmState::Snapshot snapshot = this->GetCurrentSnapshot();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
lg->GetMakefile()->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
lg->GetMakefile()->SetCurrentSourceDirectory
@@ -469,9 +471,10 @@ 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<cmLocalGenerator> lg(gg->MakeLocalGenerator());
- cmMakefile* mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
mf->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
mf->SetCurrentSourceDirectory
@@ -2059,8 +2062,8 @@ int cmake::CheckBuildSystem()
cm.SetHomeDirectory("");
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.MakeLocalGenerator());
- cmMakefile* mf = lg->GetMakefile();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
+ cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
{
@@ -2089,8 +2092,11 @@ int cmake::CheckBuildSystem()
ggd(this->CreateGlobalGenerator(genName));
if(ggd.get())
{
- cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator());
- lgd->ClearDependencies(mf, verbose);
+ 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);
}
}
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 7bee0ea..aa70aa0 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -768,7 +768,10 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen))
{
cm.SetGlobalGenerator(ggd);
- cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->MakeLocalGenerator());
+ cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
+ cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(ggd, snapshot));
+ cmsys::auto_ptr<cmLocalGenerator> lgd(
+ ggd->CreateLocalGenerator(mf.get()));
lgd->GetMakefile()->SetCurrentSourceDirectory(startDir);
lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir);