From e7dcdd1011719b031d580d9094ad1f8c4701ef38 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 8 Jul 2015 11:13:11 -0400 Subject: cmCommonTargetGenerator: Adopt basic target generator members De-duplicate the GeneratorTarget, Target, and Makefile members from the local Makefile and Ninja generators. --- Source/cmCommonTargetGenerator.cxx | 13 ++++++++++++- Source/cmCommonTargetGenerator.h | 15 ++++++++++++++- Source/cmMakefileTargetGenerator.cxx | 5 +---- Source/cmMakefileTargetGenerator.h | 3 --- Source/cmNinjaTargetGenerator.cxx | 5 +---- Source/cmNinjaTargetGenerator.h | 3 --- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index e1f7522..9d10e39 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -11,7 +11,18 @@ ============================================================================*/ #include "cmCommonTargetGenerator.h" -cmCommonTargetGenerator::cmCommonTargetGenerator() +#include "cmGeneratorTarget.h" +#include "cmGlobalCommonGenerator.h" +#include "cmLocalCommonGenerator.h" +#include "cmTarget.h" + +cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) + : GeneratorTarget(gt) + , Target(gt->Target) + , Makefile(gt->Makefile) + , LocalGenerator(static_cast(gt->LocalGenerator)) + , GlobalGenerator(static_cast( + gt->LocalGenerator->GetGlobalGenerator())) { } diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 96f4088..e39f2c8 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -14,14 +14,27 @@ #include "cmStandardIncludes.h" +class cmGeneratorTarget; +class cmGlobalCommonGenerator; +class cmLocalCommonGenerator; +class cmMakefile; +class cmTarget; + /** \class cmCommonTargetGenerator * \brief Common infrastructure for Makefile and Ninja per-target generators */ class cmCommonTargetGenerator { public: - cmCommonTargetGenerator(); + cmCommonTargetGenerator(cmGeneratorTarget* gt); virtual ~cmCommonTargetGenerator(); + +protected: + cmGeneratorTarget* GeneratorTarget; + cmTarget* Target; + cmMakefile* Makefile; + cmLocalCommonGenerator* LocalGenerator; + cmGlobalCommonGenerator* GlobalGenerator; }; #endif diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 2f53899..3e45d10 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -33,7 +33,7 @@ #include cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) - : cmCommonTargetGenerator() + : cmCommonTargetGenerator(target) , OSXBundleGenerator(0) , MacOSXContentGenerator(0) { @@ -42,15 +42,12 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) this->FlagFileStream = 0; this->CustomCommandDriver = OnBuild; this->FortranModuleDirectoryComputed = false; - this->Target = target->Target; - this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = static_cast(target->GetLocalGenerator()); this->ConfigName = this->LocalGenerator->ConfigurationName.c_str(); this->GlobalGenerator = static_cast( this->LocalGenerator->GetGlobalGenerator()); - this->GeneratorTarget = target; cmake* cm = this->GlobalGenerator->GetCMakeInstance(); this->NoRuleMessages = false; if(const char* ruleStatus = cm->GetState() diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index a438717..787f246 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -175,11 +175,8 @@ protected: virtual void CloseFileStreams(); void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang, std::string& linkFlags); - cmTarget *Target; - cmGeneratorTarget* GeneratorTarget; cmLocalUnixMakefileGenerator3 *LocalGenerator; cmGlobalUnixMakefileGenerator3 *GlobalGenerator; - cmMakefile *Makefile; std::string ConfigName; enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility }; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 93b3f4e..5ede08a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -58,17 +58,14 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target) } cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) - : cmCommonTargetGenerator(), + : cmCommonTargetGenerator(target), MacOSXContentGenerator(0), OSXBundleGenerator(0), MacContentFolders(), - Target(target->Target), - Makefile(target->Makefile), LocalGenerator( static_cast(target->GetLocalGenerator())), Objects() { - this->GeneratorTarget = target; MacOSXContentGenerator = new MacOSXContentGeneratorType(this); } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index a98f04e..87ba17f 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -152,9 +152,6 @@ protected: cmNinjaVars& vars); private: - cmTarget* Target; - cmGeneratorTarget* GeneratorTarget; - cmMakefile* Makefile; cmLocalNinjaGenerator* LocalGenerator; /// List of object files for this target. cmNinjaDeps Objects; -- cgit v0.12