1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-20 21:40:15 +08:00

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.
This commit is contained in:
Stephen Kelly
2016-10-13 00:18:25 +02:00
parent 637e3f3ee1
commit a0a720e6a7
4 changed files with 15 additions and 0 deletions

View File

@@ -320,6 +320,11 @@ cmGeneratorTarget::~cmGeneratorTarget()
cmDeleteAll(this->LinkInformation); cmDeleteAll(this->LinkInformation);
} }
cmGlobalGenerator* cmGeneratorTarget::GetGlobalGenerator() const
{
return this->GetLocalGenerator()->GetGlobalGenerator();
}
cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const
{ {
return this->LocalGenerator; return this->LocalGenerator;

View File

@@ -32,6 +32,8 @@ public:
cmLocalGenerator* GetLocalGenerator() const; cmLocalGenerator* GetLocalGenerator() const;
cmGlobalGenerator* GetGlobalGenerator() const;
bool IsImported() const; bool IsImported() const;
bool IsImportedGloballyVisible() const; bool IsImportedGloballyVisible() const;
const char* GetLocation(const std::string& config) const; const char* GetLocation(const std::string& config) const;

View File

@@ -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) void cmTarget::AddUtility(const std::string& u, cmMakefile* makefile)
{ {
if (this->Utilities.insert(u).second && makefile) { if (this->Utilities.insert(u).second && makefile) {

View File

@@ -30,6 +30,7 @@
class cmMakefile; class cmMakefile;
class cmSourceFile; class cmSourceFile;
class cmGlobalGenerator;
class cmTargetInternals; class cmTargetInternals;
class cmTargetInternalPointer class cmTargetInternalPointer
@@ -76,6 +77,8 @@ public:
*/ */
cmState::TargetType GetType() const { return this->TargetTypeValue; } cmState::TargetType GetType() const { return this->TargetTypeValue; }
cmGlobalGenerator* GetGlobalGenerator() const;
///! Set/Get the name of the target ///! Set/Get the name of the target
const std::string& GetName() const { return this->Name; } const std::string& GetName() const { return this->Name; }