From a0a720e6a70133e361762101ce69a0b3f1ab244d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Oct 2016 00:18:25 +0200 Subject: cm{,Generator}Target: Add global generator accessors Provide 'static polymorphism' between the types in this aspect so that they can be used indiscriminately in a C++ template. --- Source/cmGeneratorTarget.cxx | 5 +++++ Source/cmGeneratorTarget.h | 2 ++ Source/cmTarget.cxx | 5 +++++ Source/cmTarget.h | 3 +++ 4 files changed, 15 insertions(+) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d622ad9..fb732a6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -320,6 +320,11 @@ cmGeneratorTarget::~cmGeneratorTarget() cmDeleteAll(this->LinkInformation); } +cmGlobalGenerator* cmGeneratorTarget::GetGlobalGenerator() const +{ + return this->GetLocalGenerator()->GetGlobalGenerator(); +} + cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const { return this->LocalGenerator; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 68ffd5c..bfbd790 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -32,6 +32,8 @@ public: cmLocalGenerator* GetLocalGenerator() const; + cmGlobalGenerator* GetGlobalGenerator() const; + bool IsImported() const; bool IsImportedGloballyVisible() const; const char* GetLocation(const std::string& config) const; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 52f1d04..76a12d4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -272,6 +272,11 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type, } } +cmGlobalGenerator* cmTarget::GetGlobalGenerator() const +{ + return this->GetMakefile()->GetGlobalGenerator(); +} + void cmTarget::AddUtility(const std::string& u, cmMakefile* makefile) { if (this->Utilities.insert(u).second && makefile) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 84f43b3..2d259ed 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -30,6 +30,7 @@ class cmMakefile; class cmSourceFile; +class cmGlobalGenerator; class cmTargetInternals; class cmTargetInternalPointer @@ -76,6 +77,8 @@ public: */ cmState::TargetType GetType() const { return this->TargetTypeValue; } + cmGlobalGenerator* GetGlobalGenerator() const; + ///! Set/Get the name of the target const std::string& GetName() const { return this->Name; } -- cgit v0.12