From 9b6a743b801dffa9f7ccab0c3e73fa8d22f3b8b9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 2 Aug 2015 11:08:49 +0200 Subject: cmLocalGenerator: Remove Parent pointer. --- Source/cmGlobalBorlandMakefileGenerator.cxx | 4 ++-- Source/cmGlobalBorlandMakefileGenerator.h | 3 +-- Source/cmGlobalGenerator.cxx | 10 ++++------ Source/cmGlobalGenerator.h | 8 +++----- Source/cmGlobalGhsMultiGenerator.cxx | 5 ++--- Source/cmGlobalGhsMultiGenerator.h | 3 +-- Source/cmGlobalNinjaGenerator.cxx | 5 ++--- Source/cmGlobalNinjaGenerator.h | 3 +-- Source/cmGlobalUnixMakefileGenerator3.cxx | 7 +++---- Source/cmGlobalUnixMakefileGenerator3.h | 3 +-- Source/cmGlobalVisualStudio10Generator.cxx | 7 +++---- Source/cmGlobalVisualStudio10Generator.h | 3 +-- Source/cmGlobalVisualStudio6Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio6Generator.h | 3 +-- Source/cmGlobalVisualStudio7Generator.cxx | 7 +++---- Source/cmGlobalVisualStudio7Generator.h | 3 +-- Source/cmGlobalXCodeGenerator.cxx | 5 ++--- Source/cmGlobalXCodeGenerator.h | 3 +-- Source/cmLocalCommonGenerator.cxx | 3 +-- Source/cmLocalCommonGenerator.h | 1 - Source/cmLocalGenerator.cxx | 2 -- Source/cmLocalGenerator.h | 7 +------ Source/cmLocalGhsMultiGenerator.cxx | 3 +-- Source/cmLocalGhsMultiGenerator.h | 2 +- Source/cmLocalNinjaGenerator.cxx | 3 +-- Source/cmLocalNinjaGenerator.h | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 4 ++-- Source/cmLocalUnixMakefileGenerator3.h | 1 - Source/cmLocalVisualStudio10Generator.cxx | 3 +-- Source/cmLocalVisualStudio10Generator.h | 1 - Source/cmLocalVisualStudio6Generator.cxx | 3 +-- Source/cmLocalVisualStudio6Generator.h | 1 - Source/cmLocalVisualStudio7Generator.cxx | 3 +-- Source/cmLocalVisualStudio7Generator.h | 1 - Source/cmLocalVisualStudioGenerator.cxx | 3 +-- Source/cmLocalVisualStudioGenerator.h | 1 - Source/cmLocalXCodeGenerator.cxx | 3 +-- Source/cmLocalXCodeGenerator.h | 2 +- Source/cmMakefile.cxx | 2 +- 39 files changed, 49 insertions(+), 88 deletions(-) diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 87665a0..c31f952 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) + cmState::Snapshot snapshot) { cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(this, parent, snapshot); + new cmLocalUnixMakefileGenerator3(this, snapshot); lg->SetMakefileVariableSize(32); lg->SetMakeCommandEscapeTargetTwice(true); lg->SetBorlandMakeCurlyHack(true); diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 2ec510d..62e458f 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(cmState::Snapshot snapshot); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 46c1ccc..01f50ed 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1986,22 +1986,20 @@ void cmGlobalGenerator::EnableInstallTarget() } cmLocalGenerator * -cmGlobalGenerator::MakeLocalGenerator(cmState::Snapshot snapshot, - cmLocalGenerator *parent) +cmGlobalGenerator::MakeLocalGenerator(cmState::Snapshot snapshot) { if (!snapshot.IsValid()) { snapshot = this->CMakeInstance->GetCurrentSnapshot(); } - return this->CreateLocalGenerator(parent, snapshot); + return this->CreateLocalGenerator(snapshot); } cmLocalGenerator* -cmGlobalGenerator::CreateLocalGenerator(cmLocalGenerator* parent, - cmState::Snapshot snapshot) +cmGlobalGenerator::CreateLocalGenerator(cmState::Snapshot snapshot) { - return new cmLocalGenerator(this, parent, snapshot); + return new cmLocalGenerator(this, snapshot); } void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 21cbd44..2e0f7b5 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); + cmLocalGenerator* + MakeLocalGenerator(cmState::Snapshot snapshot = cmState::Snapshot()); ///! Get the name for this generator virtual std::string GetName() const { return "Generic"; } @@ -442,8 +441,7 @@ protected: private: ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent, - cmState::Snapshot snapshot); + virtual cmLocalGenerator *CreateLocalGenerator(cmState::Snapshot snapshot); cmMakefile* TryCompileOuterMakefile; // If you add a new map here, make sure it is copied diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index f764418..29abb37 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(cmState::Snapshot snapshot) { - return new cmLocalGhsMultiGenerator(this, parent, snapshot); + return new cmLocalGhsMultiGenerator(this, snapshot); } void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry) diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index f1a3ed7..873c20f 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -31,8 +31,7 @@ public: { return new cmGlobalGeneratorSimpleFactory(); } ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent, - cmState::Snapshot snapshot); + virtual cmLocalGenerator *CreateLocalGenerator(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 b92ad32..72ef4d6 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(cmState::Snapshot snapshot) { - return new cmLocalNinjaGenerator(this, parent, snapshot); + return new cmLocalNinjaGenerator(this, snapshot); } void cmGlobalNinjaGenerator diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index f103801..418d6f7 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -170,8 +170,7 @@ public: virtual ~cmGlobalNinjaGenerator() { } /// Overloaded methods. @see cmGlobalGenerator::CreateLocalGenerator() - virtual cmLocalGenerator* CreateLocalGenerator(cmLocalGenerator* parent, - cmState::Snapshot snapshot); + virtual cmLocalGenerator* CreateLocalGenerator(cmState::Snapshot snapshot); /// Overloaded methods. @see cmGlobalGenerator::GetName(). virtual std::string GetName() const { diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 605ece2..0f491aa 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( + cmState::Snapshot snapshot) { - return new cmLocalUnixMakefileGenerator3(this, parent, snapshot); + return new cmLocalUnixMakefileGenerator3(this, snapshot); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index c738c16..3ea6bb2 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -68,8 +68,7 @@ public: 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(cmState::Snapshot snapshot); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 8ec4fd9..a36fed1 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( + cmState::Snapshot snapshot) { - return new cmLocalVisualStudio10Generator(this, parent, snapshot); + return new cmLocalVisualStudio10Generator(this, snapshot); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 3d34a3f..bbc22b9 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(cmState::Snapshot snapshot); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index b7c897c..48c3d32 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -173,10 +173,10 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( ///! Create a local generator appropriate to this Global Generator cmLocalGenerator * -cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmLocalGenerator* parent, +cmGlobalVisualStudio6Generator::CreateLocalGenerator( cmState::Snapshot snapshot) { - return new cmLocalVisualStudio6Generator(this, parent, snapshot); + return new cmLocalVisualStudio6Generator(this, snapshot); } diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 420cb0b..0169be0 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(cmState::Snapshot snapshot); /** * Try to determine system information such as shared library diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 2660d23..b8f6357 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( + cmState::Snapshot snapshot) { cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(this, parent, snapshot); + new cmLocalVisualStudio7Generator(this, snapshot); return lg; } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 931ac9c..5ada2c5 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(cmState::Snapshot snapshot); virtual bool SetSystemName(std::string const& s, cmMakefile* mf); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index eb547bd..af3629d 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(cmState::Snapshot snapshot) { - return new cmLocalXCodeGenerator(this, parent, snapshot); + return new cmLocalXCodeGenerator(this, snapshot); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ee8bf2c..f93f62f 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(cmState::Snapshot snapshot); /** * Try to determine system information such as shared library diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 4583446..58c707c 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) + cmLocalGenerator(gg, snapshot) { } diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index af94cda..b7caf0b 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -23,7 +23,6 @@ class cmLocalCommonGenerator: public cmLocalGenerator { public: cmLocalCommonGenerator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot); ~cmLocalCommonGenerator(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7ce4819..aea14d5 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -43,13 +43,11 @@ #endif cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot) : cmOutputConverter(snapshot), StateSnapshot(snapshot) { assert(snapshot.IsValid()); this->GlobalGenerator = gg; - this->Parent = parent; this->Makefile = new cmMakefile(this); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 915814b..4c0b1fe 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, cmState::Snapshot snapshot); 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 UniqueObjectNamesMap; std::string::size_type ObjectPathMax; std::set ObjectMaxPathViolations; diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index 8e498dd..91dfeb4 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) + : cmLocalGenerator(gg, snapshot) { } diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h index f52ef39..3309bfd 100644 --- a/Source/cmLocalGhsMultiGenerator.h +++ b/Source/cmLocalGhsMultiGenerator.h @@ -25,7 +25,7 @@ class cmGeneratedFileStream; class cmLocalGhsMultiGenerator : public cmLocalGenerator { public: - cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, + cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmState::Snapshot snapshot); virtual ~cmLocalGhsMultiGenerator(); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index cfca418..62bf8b2 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -23,9 +23,8 @@ #include cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot) - : cmLocalCommonGenerator(gg, parent, snapshot) + : cmLocalCommonGenerator(gg, snapshot) , HomeRelativeOutputPath("") { this->TargetImplib = "$TARGET_IMPLIB"; diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index d10be0c..4c158bc 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -31,7 +31,7 @@ class cmake; class cmLocalNinjaGenerator : public cmLocalCommonGenerator { public: - cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, + cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmState::Snapshot snapshot); virtual ~cmLocalNinjaGenerator(); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 589105e..d2b60d3 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -80,9 +80,9 @@ static std::string cmSplitExtension(std::string const& in, std::string& base) //---------------------------------------------------------------------------- cmLocalUnixMakefileGenerator3:: -cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent, +cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmState::Snapshot snapshot) - : cmLocalCommonGenerator(gg, parent, snapshot) + : cmLocalCommonGenerator(gg, snapshot) { this->MakefileVariableSize = 0; this->ColorMakefile = false; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 01ac01b..2b9af38 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -35,7 +35,6 @@ class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator { public: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot); virtual ~cmLocalUnixMakefileGenerator3(); diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 9e3185c..25b3f19 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -63,9 +63,8 @@ class cmVS10XMLParser : public cmXMLParser //---------------------------------------------------------------------------- cmLocalVisualStudio10Generator ::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot): - cmLocalVisualStudio7Generator(gg, parent, snapshot) + cmLocalVisualStudio7Generator(gg, snapshot) { } diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index c588aaf..0f179fd 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -26,7 +26,6 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator public: ///! Set cache only and recurse to false by default. cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot); virtual ~cmLocalVisualStudio10Generator(); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 3a44367..46e1987 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -25,9 +25,8 @@ cmLocalVisualStudio6Generator ::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot): - cmLocalVisualStudioGenerator(gg, parent, snapshot) + cmLocalVisualStudioGenerator(gg, snapshot) { } diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index a44e61d..86b4906 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -30,7 +30,6 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator public: ///! Set cache only and recurse to false by default. cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot); virtual ~cmLocalVisualStudio6Generator(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 55ad852..eebed7e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -54,9 +54,8 @@ static void cmConvertToWindowsSlash(std::string& s) //---------------------------------------------------------------------------- cmLocalVisualStudio7Generator ::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot): - cmLocalVisualStudioGenerator(gg, parent, snapshot) + cmLocalVisualStudioGenerator(gg, snapshot) { this->Internal = new cmLocalVisualStudio7GeneratorInternals(this); } diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 43f3af9..42ae097 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -36,7 +36,6 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator public: ///! Set cache only and recurse to false by default. cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot); virtual ~cmLocalVisualStudio7Generator(); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 3588853..70f729f 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -20,9 +20,8 @@ //---------------------------------------------------------------------------- cmLocalVisualStudioGenerator ::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot) - : cmLocalGenerator(gg, parent, snapshot) + : cmLocalGenerator(gg, snapshot) { } diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index d414651..32244c7 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -32,7 +32,6 @@ class cmLocalVisualStudioGenerator : public cmLocalGenerator { public: cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, - cmLocalGenerator* parent, cmState::Snapshot snapshot); virtual ~cmLocalVisualStudioGenerator(); diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 804dd7d..d6576f6 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) + : cmLocalGenerator(gg, 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 26fff9c..d96e78c 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -24,7 +24,7 @@ class cmLocalXCodeGenerator : public cmLocalGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, + cmLocalXCodeGenerator(cmGlobalGenerator* gg, cmState::Snapshot snapshot); virtual ~cmLocalXCodeGenerator(); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4a4663a..2ba12a4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1755,7 +1755,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, // create a new local generator and set its parent cmLocalGenerator *lg2 = this->GetGlobalGenerator() - ->MakeLocalGenerator(newSnapshot, this->LocalGenerator); + ->MakeLocalGenerator(newSnapshot); this->GetGlobalGenerator()->AddMakefile(lg2->GetMakefile()); this->GetGlobalGenerator()->AddLocalGenerator(lg2); -- cgit v0.12 From 83b8a927e5a992480e96b0be36ea0426a924c41f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 2 Aug 2015 11:20:28 +0200 Subject: cmMakefile: Remove cmLocalGenerator member. --- Source/cmLocalGenerator.cxx | 2 +- Source/cmMakefile.cxx | 11 ++++++----- Source/cmMakefile.h | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index aea14d5..357a508 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -49,7 +49,7 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, assert(snapshot.IsValid()); this->GlobalGenerator = gg; - this->Makefile = new cmMakefile(this); + this->Makefile = new cmMakefile(gg, snapshot); this->EmitUniversalBinaryFlags = true; this->BackwardsCompatibility = 0; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 2ba12a4..10ce0b3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -44,9 +44,10 @@ #include // 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; @@ -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 FinalPassCommands; - cmLocalGenerator* LocalGenerator; + cmGlobalGenerator* GlobalGenerator; bool IsFunctionBlocked(const cmListFileFunction& lff, cmExecutionStatus &status); -- cgit v0.12 From acb006229dbc531303538f4de1dc4d16d27369a5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 31 May 2015 01:43:31 +0200 Subject: cmGlobalGenerator: Require a snapshot to create a local generator. --- Source/CPack/cmCPackGenerator.cxx | 3 ++- Source/CPack/cpack.cxx | 3 ++- Source/CTest/cmCTestLaunch.cxx | 3 ++- Source/CTest/cmCTestScriptHandler.cxx | 3 ++- Source/CTest/cmCTestTestHandler.cxx | 3 ++- Source/cmCTest.cxx | 3 ++- Source/cmGlobalGenerator.cxx | 8 ++------ Source/cmGlobalUnixMakefileGenerator3.cxx | 3 ++- Source/cmGraphVizWriter.cxx | 3 ++- Source/cmQtAutoGenerators.cxx | 3 ++- Source/cmake.cxx | 12 ++++++++---- Source/cmcmd.cxx | 4 +++- 12 files changed, 31 insertions(+), 20 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index bf4df60..68509a5 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -716,7 +716,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cm.AddCMakePaths(); cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg(gg.MakeLocalGenerator()); + cmsys::auto_ptr lg( + gg.MakeLocalGenerator(cm.GetCurrentSnapshot())); 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 c2fe763..0c53d1b 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -202,7 +202,8 @@ int main (int argc, char const* const* argv) cminst.SetHomeOutputDirectory(""); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg(&cminst); - cmsys::auto_ptr cmlg(cmgg.MakeLocalGenerator()); + cmsys::auto_ptr cmlg( + cmgg.MakeLocalGenerator(cminst.GetCurrentSnapshot())); cmMakefile* globalMF = cmlg->GetMakefile(); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 0f588c5..d978568 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -738,7 +738,8 @@ void cmCTestLaunch::LoadConfig() cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg(gg.MakeLocalGenerator()); + cmsys::auto_ptr lg( + gg.MakeLocalGenerator(cm.GetCurrentSnapshot())); cmMakefile* mf = lg->GetMakefile(); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 047bd98..c791302 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -341,7 +341,8 @@ void cmCTestScriptHandler::CreateCMake() this->CMake->AddCMakePaths(); this->GlobalGenerator = new cmGlobalGenerator(this->CMake); - this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator(); + cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot(); + this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator(snapshot); this->Makefile = this->LocalGenerator->GetMakefile(); this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index c8a0d27..3262efd 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1592,7 +1592,8 @@ void cmCTestTestHandler::GetListOfTests() cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg(gg.MakeLocalGenerator()); + cmsys::auto_ptr lg( + gg.MakeLocalGenerator(cm.GetCurrentSnapshot())); 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 b976469..f020f9e 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -520,7 +520,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg(gg.MakeLocalGenerator()); + cmsys::auto_ptr lg( + gg.MakeLocalGenerator(cm.GetCurrentSnapshot())); cmMakefile *mf = lg->GetMakefile(); if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) ) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 01f50ed..251fa52 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1128,7 +1128,8 @@ void cmGlobalGenerator::Configure() this->ClearGeneratorMembers(); // start with this directory - cmLocalGenerator *lg = this->MakeLocalGenerator(); + cmLocalGenerator *lg = this->MakeLocalGenerator( + this->GetCMakeInstance()->GetCurrentSnapshot()); this->Makefiles.push_back(lg->GetMakefile()); this->LocalGenerators.push_back(lg); @@ -1988,11 +1989,6 @@ void cmGlobalGenerator::EnableInstallTarget() cmLocalGenerator * cmGlobalGenerator::MakeLocalGenerator(cmState::Snapshot snapshot) { - if (!snapshot.IsValid()) - { - snapshot = this->CMakeInstance->GetCurrentSnapshot(); - } - return this->CreateLocalGenerator(snapshot); } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 0f491aa..c396af4 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -585,8 +585,9 @@ void cmGlobalUnixMakefileGenerator3 } else { + cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); lg = static_cast - (this->MakeLocalGenerator()); + (this->MakeLocalGenerator(snapshot)); // set the Start directories lg->GetMakefile()->SetCurrentSourceDirectory (this->CMakeInstance->GetHomeDirectory()); diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index fa29b4f..797b198 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -68,7 +68,8 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator ggi(&cm); - cmsys::auto_ptr lg(ggi.MakeLocalGenerator()); + cmsys::auto_ptr lg( + ggi.MakeLocalGenerator(cm.GetCurrentSnapshot())); cmMakefile *mf = lg->GetMakefile(); const char* inFileName = settingsFileName; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 0a4b546..c6c045a 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1217,7 +1217,8 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, cm.SetHomeDirectory(targetDirectory); cmGlobalGenerator gg(&cm); - cmLocalGenerator* lg = gg.MakeLocalGenerator(); + cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); + cmLocalGenerator* lg = gg.MakeLocalGenerator(snapshot); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); gg.SetCurrentMakefile(lg->GetMakefile()); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 1f5c4d4..29271b8 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -429,7 +429,8 @@ void cmake::ReadListFile(const std::vector& args, std::string homeOutputDir = this->GetHomeOutputDirectory(); this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); - cmsys::auto_ptr lg(gg->MakeLocalGenerator()); + cmState::Snapshot snapshot = this->GetCurrentSnapshot(); + cmsys::auto_ptr lg(gg->MakeLocalGenerator(snapshot)); lg->GetMakefile()->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetCurrentSourceDirectory @@ -469,8 +470,9 @@ bool cmake::FindPackage(const std::vector& 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 lg(gg->MakeLocalGenerator()); + cmsys::auto_ptr lg(gg->MakeLocalGenerator(snapshot)); cmMakefile* mf = lg->GetMakefile(); mf->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); @@ -2059,7 +2061,8 @@ int cmake::CheckBuildSystem() cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg(gg.MakeLocalGenerator()); + cmsys::auto_ptr lg( + gg.MakeLocalGenerator(cm.GetCurrentSnapshot())); cmMakefile* mf = lg->GetMakefile(); if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) @@ -2089,7 +2092,8 @@ int cmake::CheckBuildSystem() ggd(this->CreateGlobalGenerator(genName)); if(ggd.get()) { - cmsys::auto_ptr lgd(ggd->MakeLocalGenerator()); + cmsys::auto_ptr lgd( + ggd->MakeLocalGenerator(cm.GetCurrentSnapshot())); lgd->ClearDependencies(mf, verbose); } } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 7bee0ea..868dbe3 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -768,7 +768,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) { cm.SetGlobalGenerator(ggd); - cmsys::auto_ptr lgd(ggd->MakeLocalGenerator()); + cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); + cmsys::auto_ptr lgd( + ggd->MakeLocalGenerator(snapshot)); lgd->GetMakefile()->SetCurrentSourceDirectory(startDir); lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir); -- cgit v0.12 From 92041eec49ab4968b2d4f09e3bd71a3720d86036 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 2 Aug 2015 11:30:12 +0200 Subject: cmGlobalGenerator: Remove MakeLocalGenerator method. Inline implementation to callers. --- Source/CPack/cmCPackGenerator.cxx | 2 +- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 2 +- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/cmCTest.cxx | 2 +- Source/cmGlobalGenerator.cxx | 8 +------- Source/cmGlobalGenerator.h | 7 ++----- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGraphVizWriter.cxx | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmake.cxx | 8 ++++---- Source/cmcmd.cxx | 2 +- 14 files changed, 18 insertions(+), 27 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 68509a5..8cbcd4e 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -717,7 +717,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg(&cm); cmsys::auto_ptr lg( - gg.MakeLocalGenerator(cm.GetCurrentSnapshot())); + gg.CreateLocalGenerator(cm.GetCurrentSnapshot())); 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 0c53d1b..96351f7 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -203,7 +203,7 @@ int main (int argc, char const* const* argv) cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg(&cminst); cmsys::auto_ptr cmlg( - cmgg.MakeLocalGenerator(cminst.GetCurrentSnapshot())); + cmgg.CreateLocalGenerator(cminst.GetCurrentSnapshot())); cmMakefile* globalMF = cmlg->GetMakefile(); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index d978568..7340d5c 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -739,7 +739,7 @@ void cmCTestLaunch::LoadConfig() cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); cmsys::auto_ptr lg( - gg.MakeLocalGenerator(cm.GetCurrentSnapshot())); + gg.CreateLocalGenerator(cm.GetCurrentSnapshot())); cmMakefile* mf = lg->GetMakefile(); std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index c791302..8327f29 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -342,7 +342,7 @@ void cmCTestScriptHandler::CreateCMake() this->GlobalGenerator = new cmGlobalGenerator(this->CMake); cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot(); - this->LocalGenerator = this->GlobalGenerator->MakeLocalGenerator(snapshot); + this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator(snapshot); this->Makefile = this->LocalGenerator->GetMakefile(); this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 3262efd..9e00193 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1593,7 +1593,7 @@ void cmCTestTestHandler::GetListOfTests() cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); cmsys::auto_ptr lg( - gg.MakeLocalGenerator(cm.GetCurrentSnapshot())); + gg.CreateLocalGenerator(cm.GetCurrentSnapshot())); 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 f020f9e..1786c2c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -521,7 +521,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); cmsys::auto_ptr lg( - gg.MakeLocalGenerator(cm.GetCurrentSnapshot())); + gg.CreateLocalGenerator(cm.GetCurrentSnapshot())); cmMakefile *mf = lg->GetMakefile(); if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) ) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 251fa52..fba14e5 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1128,7 +1128,7 @@ void cmGlobalGenerator::Configure() this->ClearGeneratorMembers(); // start with this directory - cmLocalGenerator *lg = this->MakeLocalGenerator( + cmLocalGenerator *lg = this->CreateLocalGenerator( this->GetCMakeInstance()->GetCurrentSnapshot()); this->Makefiles.push_back(lg->GetMakefile()); this->LocalGenerators.push_back(lg); @@ -1986,12 +1986,6 @@ void cmGlobalGenerator::EnableInstallTarget() this->InstallTargetEnabled = true; } -cmLocalGenerator * -cmGlobalGenerator::MakeLocalGenerator(cmState::Snapshot snapshot) -{ - return this->CreateLocalGenerator(snapshot); -} - cmLocalGenerator* cmGlobalGenerator::CreateLocalGenerator(cmState::Snapshot snapshot) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 2e0f7b5..91c1aac 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -56,8 +56,8 @@ public: cmGlobalGenerator(cmake* cm); virtual ~cmGlobalGenerator(); - cmLocalGenerator* - MakeLocalGenerator(cmState::Snapshot snapshot = cmState::Snapshot()); + virtual cmLocalGenerator* + CreateLocalGenerator(cmState::Snapshot snapshot = cmState::Snapshot()); ///! Get the name for this generator virtual std::string GetName() const { return "Generic"; } @@ -440,9 +440,6 @@ protected: virtual bool UseFolderProperty(); private: - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(cmState::Snapshot snapshot); - cmMakefile* TryCompileOuterMakefile; // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index c396af4..0d4ee15 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -587,7 +587,7 @@ void cmGlobalUnixMakefileGenerator3 { cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); lg = static_cast - (this->MakeLocalGenerator(snapshot)); + (this->CreateLocalGenerator(snapshot)); // set the Start directories lg->GetMakefile()->SetCurrentSourceDirectory (this->CMakeInstance->GetHomeDirectory()); diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 797b198..7da3085 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -69,7 +69,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, cm.SetHomeOutputDirectory(""); cmGlobalGenerator ggi(&cm); cmsys::auto_ptr lg( - ggi.MakeLocalGenerator(cm.GetCurrentSnapshot())); + ggi.CreateLocalGenerator(cm.GetCurrentSnapshot())); cmMakefile *mf = lg->GetMakefile(); const char* inFileName = settingsFileName; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 10ce0b3..1df6213 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1756,7 +1756,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, // create a new local generator and set its parent cmLocalGenerator *lg2 = this->GetGlobalGenerator() - ->MakeLocalGenerator(newSnapshot); + ->CreateLocalGenerator(newSnapshot); this->GetGlobalGenerator()->AddMakefile(lg2->GetMakefile()); this->GetGlobalGenerator()->AddLocalGenerator(lg2); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index c6c045a..9cb005c 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1218,7 +1218,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, cmGlobalGenerator gg(&cm); cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); - cmLocalGenerator* lg = gg.MakeLocalGenerator(snapshot); + cmLocalGenerator* lg = gg.CreateLocalGenerator(snapshot); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); gg.SetCurrentMakefile(lg->GetMakefile()); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 29271b8..ebc38d8 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -430,7 +430,7 @@ void cmake::ReadListFile(const std::vector& args, this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); cmState::Snapshot snapshot = this->GetCurrentSnapshot(); - cmsys::auto_ptr lg(gg->MakeLocalGenerator(snapshot)); + cmsys::auto_ptr lg(gg->CreateLocalGenerator(snapshot)); lg->GetMakefile()->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetCurrentSourceDirectory @@ -472,7 +472,7 @@ bool cmake::FindPackage(const std::vector& args) cmState::Snapshot snapshot = this->GetCurrentSnapshot(); // read in the list file to fill the cache - cmsys::auto_ptr lg(gg->MakeLocalGenerator(snapshot)); + cmsys::auto_ptr lg(gg->CreateLocalGenerator(snapshot)); cmMakefile* mf = lg->GetMakefile(); mf->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); @@ -2062,7 +2062,7 @@ int cmake::CheckBuildSystem() cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); cmsys::auto_ptr lg( - gg.MakeLocalGenerator(cm.GetCurrentSnapshot())); + gg.CreateLocalGenerator(cm.GetCurrentSnapshot())); cmMakefile* mf = lg->GetMakefile(); if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) @@ -2093,7 +2093,7 @@ int cmake::CheckBuildSystem() if(ggd.get()) { cmsys::auto_ptr lgd( - ggd->MakeLocalGenerator(cm.GetCurrentSnapshot())); + ggd->CreateLocalGenerator(cm.GetCurrentSnapshot())); lgd->ClearDependencies(mf, verbose); } } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 868dbe3..c788474 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -770,7 +770,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) cm.SetGlobalGenerator(ggd); cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); cmsys::auto_ptr lgd( - ggd->MakeLocalGenerator(snapshot)); + ggd->CreateLocalGenerator(snapshot)); lgd->GetMakefile()->SetCurrentSourceDirectory(startDir); lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir); -- cgit v0.12 From 7fdc9a8b5f63f645b5aedede4fd18e0c1d1c39c5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 2 Aug 2015 11:41:48 +0200 Subject: QtAutogen: Use a smart pointer. --- Source/cmQtAutoGenerators.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 9cb005c..9803c01 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1218,7 +1218,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, cmGlobalGenerator gg(&cm); cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); - cmLocalGenerator* lg = gg.CreateLocalGenerator(snapshot); + cmsys::auto_ptr lg(gg.CreateLocalGenerator(snapshot)); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); gg.SetCurrentMakefile(lg->GetMakefile()); @@ -1235,7 +1235,6 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, this->WriteOldMocDefinitionsFile(targetDirectory); - delete lg; return success; } -- cgit v0.12 From 2f2d4da9dd031cdf9f8a0cadcbdffe38c2170353 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 24 Aug 2015 23:00:21 +0200 Subject: cmCTestScriptHandler: Simplify deletes. Deleting a nullptr is fine. --- Source/CTest/cmCTestScriptHandler.cxx | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 8327f29..4be5eb6 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -126,20 +126,14 @@ void cmCTestScriptHandler::Initialize() this->ScriptStartTime = 0; 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; } //---------------------------------------------------------------------- @@ -147,20 +141,9 @@ 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->LocalGenerator; + delete this->GlobalGenerator; + delete this->CMake; } -- cgit v0.12 From 0bd7279fd9608702b7790822c80f3c284de8e7e4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 27 Aug 2015 22:13:34 +0200 Subject: Ninja: Remove some incorrect comments adding no value. --- Source/cmGlobalNinjaGenerator.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 418d6f7..ecc8928 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -162,32 +162,24 @@ public: public: cmGlobalNinjaGenerator(cmake* cm); - /// Convenience method for creating an instance of this class. static cmGlobalGeneratorFactory* NewFactory() { return new cmGlobalGeneratorSimpleFactory(); } - /// Destructor. virtual ~cmGlobalNinjaGenerator() { } - /// Overloaded methods. @see cmGlobalGenerator::CreateLocalGenerator() virtual cmLocalGenerator* CreateLocalGenerator(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::vectorconst& languages, cmMakefile* mf, bool optional); - /// Overloaded methods. @see cmGlobalGenerator::GenerateBuildCommand() virtual void GenerateBuildCommand( std::vector& makeCommand, const std::string& makeProgram, @@ -306,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; } -- cgit v0.12 From ff8ac8ee6ab3ee686621445456a765fa33c1a873 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 2 Aug 2015 11:41:51 +0200 Subject: cmLocalGenerator: Create from already-constructed cmMakefile. Don't manage the lifetime of the cmMakefile with cmLocalGenerator. --- Source/CPack/cmCPackGenerator.cxx | 5 +++-- Source/CPack/cpack.cxx | 9 +++++---- Source/CTest/cmCTestLaunch.cxx | 4 ++-- Source/CTest/cmCTestScriptHandler.cxx | 10 ++++++---- Source/CTest/cmCTestTestHandler.cxx | 4 ++-- Source/cmCTest.cxx | 8 ++++---- Source/cmGlobalBorlandMakefileGenerator.cxx | 4 ++-- Source/cmGlobalBorlandMakefileGenerator.h | 2 +- Source/cmGlobalGenerator.cxx | 13 +++++++------ Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalGhsMultiGenerator.cxx | 4 ++-- Source/cmGlobalGhsMultiGenerator.h | 2 +- Source/cmGlobalNinjaGenerator.cxx | 4 ++-- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 10 +++++++--- Source/cmGlobalUnixMakefileGenerator3.h | 3 +-- Source/cmGlobalVisualStudio10Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 5 ++--- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 4 ++-- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmGraphVizWriter.cxx | 6 +++--- Source/cmLocalCommonGenerator.cxx | 4 ++-- Source/cmLocalCommonGenerator.h | 3 +-- Source/cmLocalGenerator.cxx | 9 ++++----- Source/cmLocalGenerator.h | 2 +- Source/cmLocalGhsMultiGenerator.cxx | 4 ++-- Source/cmLocalGhsMultiGenerator.h | 3 +-- Source/cmLocalNinjaGenerator.cxx | 4 ++-- Source/cmLocalNinjaGenerator.h | 3 +-- Source/cmLocalUnixMakefileGenerator3.cxx | 5 ++--- Source/cmLocalUnixMakefileGenerator3.h | 3 +-- Source/cmLocalVisualStudio10Generator.cxx | 5 ++--- Source/cmLocalVisualStudio10Generator.h | 3 +-- Source/cmLocalVisualStudio6Generator.cxx | 5 ++--- Source/cmLocalVisualStudio6Generator.h | 3 +-- Source/cmLocalVisualStudio7Generator.cxx | 5 ++--- Source/cmLocalVisualStudio7Generator.h | 3 +-- Source/cmLocalVisualStudioGenerator.cxx | 5 ++--- Source/cmLocalVisualStudioGenerator.h | 3 +-- Source/cmLocalXCodeGenerator.cxx | 4 ++-- Source/cmLocalXCodeGenerator.h | 2 +- Source/cmMakefile.cxx | 9 ++++----- Source/cmQtAutoGenerators.cxx | 3 ++- Source/cmake.cxx | 18 ++++++++++-------- Source/cmcmd.cxx | 3 ++- 49 files changed, 112 insertions(+), 116 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 8cbcd4e..92a4b2b 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -716,9 +716,10 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( cm.AddCMakePaths(); cm.SetProgressCallback(cmCPackGeneratorProgress, this); cmGlobalGenerator gg(&cm); + cmsys::auto_ptr mf( + new cmMakefile(&gg, cm.GetCurrentSnapshot())); cmsys::auto_ptr lg( - gg.CreateLocalGenerator(cm.GetCurrentSnapshot())); - cmMakefile *mf = lg->GetMakefile(); + 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 96351f7..cb9cbc4 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -202,9 +202,10 @@ int main (int argc, char const* const* argv) cminst.SetHomeOutputDirectory(""); cminst.GetState()->RemoveUnscriptableCommands(); cmGlobalGenerator cmgg(&cminst); + cmsys::auto_ptr globalMF( + new cmMakefile(&cmgg, cminst.GetCurrentSnapshot())); cmsys::auto_ptr cmlg( - cmgg.CreateLocalGenerator(cminst.GetCurrentSnapshot())); - cmMakefile* globalMF = cmlg->GetMakefile(); + cmgg.CreateLocalGenerator(globalMF.get())); #if defined(__CYGWIN__) globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); #endif @@ -358,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 7340d5c..fb0cce6 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -738,9 +738,9 @@ void cmCTestLaunch::LoadConfig() cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); + cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); cmsys::auto_ptr lg( - gg.CreateLocalGenerator(cm.GetCurrentSnapshot())); - cmMakefile* mf = lg->GetMakefile(); + 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 4be5eb6..c1ba279 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -125,6 +125,7 @@ void cmCTestScriptHandler::Initialize() // what time in seconds did this script start running this->ScriptStartTime = 0; + delete this->Makefile; this->Makefile = 0; delete this->LocalGenerator; @@ -139,8 +140,7 @@ void cmCTestScriptHandler::Initialize() //---------------------------------------------------------------------- cmCTestScriptHandler::~cmCTestScriptHandler() { - // local generator owns the makefile - this->Makefile = 0; + delete this->Makefile; delete this->LocalGenerator; delete this->GlobalGenerator; delete this->CMake; @@ -317,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(""); @@ -325,8 +326,9 @@ void cmCTestScriptHandler::CreateCMake() this->GlobalGenerator = new cmGlobalGenerator(this->CMake); cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot(); - this->LocalGenerator = this->GlobalGenerator->CreateLocalGenerator(snapshot); - this->Makefile = this->LocalGenerator->GetMakefile(); + 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 9e00193..a523f57 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1592,9 +1592,9 @@ void cmCTestTestHandler::GetListOfTests() cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); + cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); cmsys::auto_ptr lg( - gg.CreateLocalGenerator(cm.GetCurrentSnapshot())); - cmMakefile *mf = lg->GetMakefile(); + 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 1786c2c..adefd1c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -520,10 +520,10 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg( - gg.CreateLocalGenerator(cm.GetCurrentSnapshot())); - cmMakefile *mf = lg->GetMakefile(); - if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) ) + cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + cmsys::auto_ptr 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 c31f952..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( - cmState::Snapshot snapshot) + cmMakefile *mf) { cmLocalUnixMakefileGenerator3* lg = - new cmLocalUnixMakefileGenerator3(this, 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 62e458f..b59c86d 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -36,7 +36,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(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 fba14e5..d82c7f3 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1127,10 +1127,10 @@ void cmGlobalGenerator::Configure() this->FirstTimeProgress = 0.0f; this->ClearGeneratorMembers(); - // start with this directory - cmLocalGenerator *lg = this->CreateLocalGenerator( - this->GetCMakeInstance()->GetCurrentSnapshot()); - 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 @@ -1601,6 +1601,7 @@ void cmGlobalGenerator::ClearGeneratorMembers() cmDeleteAll(this->BuildExportSets); this->BuildExportSets.clear(); + cmDeleteAll(this->Makefiles); this->Makefiles.clear(); cmDeleteAll(this->LocalGenerators); @@ -1987,9 +1988,9 @@ void cmGlobalGenerator::EnableInstallTarget() } cmLocalGenerator* -cmGlobalGenerator::CreateLocalGenerator(cmState::Snapshot snapshot) +cmGlobalGenerator::CreateLocalGenerator(cmMakefile* mf) { - return new cmLocalGenerator(this, snapshot); + return new cmLocalGenerator(this, mf); } void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 91c1aac..b113488 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -57,7 +57,7 @@ public: virtual ~cmGlobalGenerator(); virtual cmLocalGenerator* - CreateLocalGenerator(cmState::Snapshot snapshot = cmState::Snapshot()); + CreateLocalGenerator(cmMakefile* mf); ///! Get the name for this generator virtual std::string GetName() const { return "Generic"; } diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 29abb37..6dde1e3 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -33,9 +33,9 @@ cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() } cmLocalGenerator * -cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmState::Snapshot snapshot) +cmGlobalGhsMultiGenerator::CreateLocalGenerator(cmMakefile* mf) { - return new cmLocalGhsMultiGenerator(this, snapshot); + return new cmLocalGhsMultiGenerator(this, mf); } void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry &entry) diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 873c20f..8f88d4f 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -31,7 +31,7 @@ public: { return new cmGlobalGeneratorSimpleFactory(); } ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(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 72ef4d6..120bb03 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -528,9 +528,9 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm) // Virtual public methods. cmLocalGenerator* -cmGlobalNinjaGenerator::CreateLocalGenerator(cmState::Snapshot snapshot) +cmGlobalNinjaGenerator::CreateLocalGenerator(cmMakefile* mf) { - return new cmLocalNinjaGenerator(this, snapshot); + return new cmLocalNinjaGenerator(this, mf); } void cmGlobalNinjaGenerator diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index ecc8928..d204a50 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -167,7 +167,7 @@ public: virtual ~cmGlobalNinjaGenerator() { } - virtual cmLocalGenerator* CreateLocalGenerator(cmState::Snapshot snapshot); + virtual cmLocalGenerator* CreateLocalGenerator(cmMakefile* mf); virtual std::string GetName() const { return cmGlobalNinjaGenerator::GetActualName(); } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 0d4ee15..cf4fd69 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -60,9 +60,9 @@ void cmGlobalUnixMakefileGenerator3 ///! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalUnixMakefileGenerator3::CreateLocalGenerator( - cmState::Snapshot snapshot) + cmMakefile* mf) { - return new cmLocalUnixMakefileGenerator3(this, snapshot); + return new cmLocalUnixMakefileGenerator3(this, mf); } //---------------------------------------------------------------------------- @@ -577,17 +577,20 @@ void cmGlobalUnixMakefileGenerator3 makeOptions.begin(), makeOptions.end()); if (!targetName.empty()) { + cmMakefile* mf; cmLocalUnixMakefileGenerator3 *lg; if (!this->LocalGenerators.empty()) { lg = static_cast (this->LocalGenerators[0]); + mf = lg->GetMakefile(); } else { cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); + mf = new cmMakefile(this, snapshot); lg = static_cast - (this->CreateLocalGenerator(snapshot)); + (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 3ea6bb2..5f39c79 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -67,8 +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(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 a36fed1..44d632d 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -307,9 +307,9 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) ///! Create a local generator appropriate to this Global Generator cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator( - cmState::Snapshot snapshot) + cmMakefile* mf) { - return new cmLocalVisualStudio10Generator(this, snapshot); + return new cmLocalVisualStudio10Generator(this, mf); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index bbc22b9..8de7b09 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -48,7 +48,7 @@ public: virtual bool Compute(); ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(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 48c3d32..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( - cmState::Snapshot snapshot) +cmGlobalVisualStudio6Generator::CreateLocalGenerator(cmMakefile* mf) { - return new cmLocalVisualStudio6Generator(this, snapshot); + return new cmLocalVisualStudio6Generator(this, mf); } diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 0169be0..e9b24ea 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -39,7 +39,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(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 b8f6357..0175062 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -280,10 +280,10 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator( - cmState::Snapshot snapshot) + cmMakefile* mf) { cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(this, snapshot); + new cmLocalVisualStudio7Generator(this, mf); return lg; } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 5ada2c5..35575d1 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -43,7 +43,7 @@ public: std::string const& GetPlatformName() const; ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(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 af3629d..33babec 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -371,9 +371,9 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( //---------------------------------------------------------------------------- ///! Create a local generator appropriate to this Global Generator cmLocalGenerator * -cmGlobalXCodeGenerator::CreateLocalGenerator(cmState::Snapshot snapshot) +cmGlobalXCodeGenerator::CreateLocalGenerator(cmMakefile* mf) { - return new cmLocalXCodeGenerator(this, snapshot); + return new cmLocalXCodeGenerator(this, mf); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index f93f62f..102c036 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -41,7 +41,7 @@ public: static void GetDocumentation(cmDocumentationEntry& entry); ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(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 7da3085..2023697 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -68,9 +68,9 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator ggi(&cm); - cmsys::auto_ptr lg( - ggi.CreateLocalGenerator(cm.GetCurrentSnapshot())); - cmMakefile *mf = lg->GetMakefile(); + cmsys::auto_ptr mf( + new cmMakefile(&ggi, cm.GetCurrentSnapshot())); + cmsys::auto_ptr lg(ggi.CreateLocalGenerator(mf.get())); const char* inFileName = settingsFileName; diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 58c707c..5a18e2f 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -14,8 +14,8 @@ #include "cmMakefile.h" cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot): - cmLocalGenerator(gg, snapshot) + cmMakefile* mf): + cmLocalGenerator(gg, mf) { } diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index b7caf0b..6b4b1cd 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -22,8 +22,7 @@ class cmCommonTargetGenerator; class cmLocalCommonGenerator: public cmLocalGenerator { public: - cmLocalCommonGenerator(cmGlobalGenerator* gg, - 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 357a508..455b698 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -43,13 +43,13 @@ #endif cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot) - : cmOutputConverter(snapshot), StateSnapshot(snapshot) + cmMakefile* makefile) + : cmOutputConverter(makefile->GetStateSnapshot()), + StateSnapshot(makefile->GetStateSnapshot()) { - assert(snapshot.IsValid()); this->GlobalGenerator = gg; - this->Makefile = new cmMakefile(gg, snapshot); + this->Makefile = makefile; this->EmitUniversalBinaryFlags = true; this->BackwardsCompatibility = 0; @@ -58,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 4c0b1fe..28b5ed1 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -36,7 +36,7 @@ class cmCustomCommandGenerator; class cmLocalGenerator : public cmOutputConverter { public: - cmLocalGenerator(cmGlobalGenerator* gg, cmState::Snapshot snapshot); + cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile); virtual ~cmLocalGenerator(); /** diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index 91dfeb4..bac989f 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -17,8 +17,8 @@ #include "cmGeneratedFileStream.h" cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot) - : cmLocalGenerator(gg, snapshot) + cmMakefile* mf) + : cmLocalGenerator(gg, mf) { } diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h index 3309bfd..b6a9a33 100644 --- a/Source/cmLocalGhsMultiGenerator.h +++ b/Source/cmLocalGhsMultiGenerator.h @@ -25,8 +25,7 @@ class cmGeneratedFileStream; class cmLocalGhsMultiGenerator : public cmLocalGenerator { public: - cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot); + cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmMakefile* mf); virtual ~cmLocalGhsMultiGenerator(); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 62bf8b2..7525bf2 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -23,8 +23,8 @@ #include cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot) - : cmLocalCommonGenerator(gg, snapshot) + cmMakefile* mf) + : cmLocalCommonGenerator(gg, mf) , HomeRelativeOutputPath("") { this->TargetImplib = "$TARGET_IMPLIB"; diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 4c158bc..8d3d49c 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -31,8 +31,7 @@ class cmake; class cmLocalNinjaGenerator : public cmLocalCommonGenerator { public: - cmLocalNinjaGenerator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot); + cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf); virtual ~cmLocalNinjaGenerator(); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index d2b60d3..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, - cmState::Snapshot snapshot) - : cmLocalCommonGenerator(gg, 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 2b9af38..98f15e6 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -34,8 +34,7 @@ class cmSourceFile; class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator { public: - cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, - cmState::Snapshot snapshot); + cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmMakefile* mf); virtual ~cmLocalUnixMakefileGenerator3(); virtual void ComputeHomeRelativeOutputPath(); diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 25b3f19..b043b00 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -62,9 +62,8 @@ class cmVS10XMLParser : public cmXMLParser //---------------------------------------------------------------------------- cmLocalVisualStudio10Generator -::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot): - cmLocalVisualStudio7Generator(gg, snapshot) +::cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf): + cmLocalVisualStudio7Generator(gg, mf) { } diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index 0f179fd..e187590 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -25,8 +25,7 @@ class cmLocalVisualStudio10Generator : public cmLocalVisualStudio7Generator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot); + cmLocalVisualStudio10Generator(cmGlobalGenerator* gg, cmMakefile* mf); virtual ~cmLocalVisualStudio10Generator(); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 46e1987..cc94cd4 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -24,9 +24,8 @@ #include cmLocalVisualStudio6Generator -::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot): - cmLocalVisualStudioGenerator(gg, snapshot) +::cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmMakefile* mf): + cmLocalVisualStudioGenerator(gg, mf) { } diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 86b4906..828d252 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -29,8 +29,7 @@ class cmLocalVisualStudio6Generator : public cmLocalVisualStudioGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot); + cmLocalVisualStudio6Generator(cmGlobalGenerator* gg, cmMakefile* mf); virtual ~cmLocalVisualStudio6Generator(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index eebed7e..cf67251 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -53,9 +53,8 @@ static void cmConvertToWindowsSlash(std::string& s) //---------------------------------------------------------------------------- cmLocalVisualStudio7Generator -::cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot): - cmLocalVisualStudioGenerator(gg, 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 42ae097..bc05a06 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -35,8 +35,7 @@ class cmLocalVisualStudio7Generator : public cmLocalVisualStudioGenerator { public: ///! Set cache only and recurse to false by default. - cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot); + cmLocalVisualStudio7Generator(cmGlobalGenerator* gg, cmMakefile* mf); virtual ~cmLocalVisualStudio7Generator(); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 70f729f..c0072de 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -19,9 +19,8 @@ //---------------------------------------------------------------------------- cmLocalVisualStudioGenerator -::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot) - : cmLocalGenerator(gg, snapshot) +::cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf) + : cmLocalGenerator(gg, mf) { } diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 32244c7..071bfb3 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -31,8 +31,7 @@ class cmCustomCommandGenerator; class cmLocalVisualStudioGenerator : public cmLocalGenerator { public: - cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, - 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 d6576f6..b19112d 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -16,8 +16,8 @@ //---------------------------------------------------------------------------- cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot) - : cmLocalGenerator(gg, 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 d96e78c..6d0926f 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -25,7 +25,7 @@ class cmLocalXCodeGenerator : public cmLocalGenerator public: ///! Set cache only and recurse to false by default. cmLocalXCodeGenerator(cmGlobalGenerator* gg, - cmState::Snapshot snapshot); + cmMakefile* mf); virtual ~cmLocalXCodeGenerator(); virtual std::string GetTargetDirectory(cmTarget const& target) const; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1df6213..7893032 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" @@ -1754,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() - ->CreateLocalGenerator(newSnapshot); - 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); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 9803c01..becfeba 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1218,7 +1218,8 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, cmGlobalGenerator gg(&cm); cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); - cmsys::auto_ptr lg(gg.CreateLocalGenerator(snapshot)); + cmsys::auto_ptr mf(new cmMakefile(&gg, snapshot)); + cmsys::auto_ptr lg(gg.CreateLocalGenerator(mf.get())); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); gg.SetCurrentMakefile(lg->GetMakefile()); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ebc38d8..f069481 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -430,7 +430,8 @@ void cmake::ReadListFile(const std::vector& args, this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); cmState::Snapshot snapshot = this->GetCurrentSnapshot(); - cmsys::auto_ptr lg(gg->CreateLocalGenerator(snapshot)); + cmsys::auto_ptr mf(new cmMakefile(gg, snapshot)); + cmsys::auto_ptr lg(gg->CreateLocalGenerator(mf.get())); lg->GetMakefile()->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetCurrentSourceDirectory @@ -472,8 +473,8 @@ bool cmake::FindPackage(const std::vector& args) cmState::Snapshot snapshot = this->GetCurrentSnapshot(); // read in the list file to fill the cache - cmsys::auto_ptr lg(gg->CreateLocalGenerator(snapshot)); - cmMakefile* mf = lg->GetMakefile(); + cmsys::auto_ptr mf(new cmMakefile(gg, snapshot)); + cmsys::auto_ptr lg(gg->CreateLocalGenerator(mf.get())); mf->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetCurrentSourceDirectory @@ -2061,9 +2062,8 @@ int cmake::CheckBuildSystem() cm.SetHomeDirectory(""); cm.SetHomeOutputDirectory(""); cmGlobalGenerator gg(&cm); - cmsys::auto_ptr lg( - gg.CreateLocalGenerator(cm.GetCurrentSnapshot())); - cmMakefile* mf = lg->GetMakefile(); + cmsys::auto_ptr mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); + cmsys::auto_ptr lg(gg.CreateLocalGenerator(mf.get())); if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { @@ -2092,9 +2092,11 @@ int cmake::CheckBuildSystem() ggd(this->CreateGlobalGenerator(genName)); if(ggd.get()) { + cmsys::auto_ptr mfd(new cmMakefile(ggd.get(), + cm.GetCurrentSnapshot())); cmsys::auto_ptr lgd( - ggd->CreateLocalGenerator(cm.GetCurrentSnapshot())); - lgd->ClearDependencies(mf, verbose); + ggd->CreateLocalGenerator(mfd.get())); + lgd->ClearDependencies(mfd.get(), verbose); } } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index c788474..aa70aa0 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -769,8 +769,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { cm.SetGlobalGenerator(ggd); cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); + cmsys::auto_ptr mf(new cmMakefile(ggd, snapshot)); cmsys::auto_ptr lgd( - ggd->CreateLocalGenerator(snapshot)); + ggd->CreateLocalGenerator(mf.get())); lgd->GetMakefile()->SetCurrentSourceDirectory(startDir); lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir); -- cgit v0.12 From bd096d30e05fe66a0bf702fe7e366b0042ea14ae Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 2 Aug 2015 12:08:49 +0200 Subject: cmGlobalGenerator: Avoid cmLocalGenerator until after Configure. --- Source/cmGlobalGenerator.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d82c7f3..ac1c119 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1134,17 +1134,17 @@ void cmGlobalGenerator::Configure() 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(); // update the cache entry for the number of local generators, this is used // for progress -- cgit v0.12 From ebf8d0a99ac6eb231180b3315b976bcc58baa9f3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 2 Aug 2015 12:44:07 +0200 Subject: cmGlobalGenerator: Rename method. --- Source/cmGlobalGenerator.cxx | 4 ++-- Source/cmGlobalGenerator.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ac1c119..e0e5af1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1156,7 +1156,7 @@ void cmGlobalGenerator::Configure() // check for link libraries and include directories containing "NOTFOUND" // and for infinite loops - this->CheckLocalGenerators(); + this->CheckTargetProperties(); // at this point this->LocalGenerators has been filled, // so create the map from project name to vector of local generators @@ -1636,7 +1636,7 @@ void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const { } -void cmGlobalGenerator::CheckLocalGenerators() +void cmGlobalGenerator::CheckTargetProperties() { std::map notFoundMap; // std::set notFoundMap; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index b113488..9fc2d45 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -394,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; -- cgit v0.12 From 357bf469c7a6c6adad1f3269474989af9b203994 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 2 Aug 2015 12:55:05 +0200 Subject: cmGlobalGenerator: Fill the project map at compute time. --- Source/cmGlobalGenerator.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index e0e5af1..08ab163 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1158,10 +1158,6 @@ void cmGlobalGenerator::Configure() // and for infinite loops this->CheckTargetProperties(); - // 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) { std::ostringstream msg; @@ -1268,6 +1264,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 -- cgit v0.12 From 3e08b4df95208286d8891d76234f7910ff5c1d1c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 2 Aug 2015 13:25:53 +0200 Subject: cmMakefile: Skip Global targets for CMP0019 evaluation. --- Source/cmMakefile.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7893032..8a3d197 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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; } -- cgit v0.12 From 2b9a25d7f723a9876e2979de8e6c06881e0312dc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 2 Aug 2015 12:59:06 +0200 Subject: cmGlobalGenerator: Create global targets directly after Configure. --- Source/cmGlobalGenerator.cxx | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 08ab163..b3f3cba 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1146,6 +1146,22 @@ void cmGlobalGenerator::Configure() 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 char num[100]; @@ -1183,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) -- cgit v0.12