From 37554acf43f1a94f22b3b9fb8838d685ffa07194 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Nov 2013 11:47:36 +0100 Subject: [PATCH] cmMakefile: Make FindTarget const. --- Source/cmMakefile.cxx | 10 ++++------ Source/cmMakefile.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4a2153d1e..6be1fddd9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3822,21 +3822,19 @@ const char* cmMakefile::GetFeature(const char* feature, const char* config) return 0; } -cmTarget* cmMakefile::FindTarget(const char* name, bool excludeAliases) +cmTarget* cmMakefile::FindTarget(const char* name, bool excludeAliases) const { if (!excludeAliases) { - std::map::iterator i + std::map::const_iterator i = this->AliasTargets.find(name); if (i != this->AliasTargets.end()) { return i->second; } } - cmTargets& tgts = this->GetTargets(); - - cmTargets::iterator i = tgts.find ( name ); - if ( i != tgts.end() ) + cmTargets::iterator i = this->Targets.find( name ); + if ( i != this->Targets.end() ) { return &i->second; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 76958ca8f..44aaa66e6 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -533,7 +533,7 @@ public: this->GeneratorTargets = targets; } - cmTarget* FindTarget(const char* name, bool excludeAliases = false); + cmTarget* FindTarget(const char* name, bool excludeAliases = false) const; /** Find a target to use in place of the given name. The target returned may be imported or built within the project. */ @@ -902,7 +902,7 @@ protected: std::string ProjectName; // project name // libraries, classes, and executables - cmTargets Targets; + mutable cmTargets Targets; std::map AliasTargets; cmGeneratorTargetsType GeneratorTargets; std::vector SourceFiles;