cmMakefile: Use a hashmap for imported targets

This commit is contained in:
Ben Boeckel 2014-04-30 13:27:33 -04:00
parent 9442928745
commit ac4106c69a
2 changed files with 9 additions and 5 deletions

View File

@ -3911,8 +3911,7 @@ cmTarget* cmMakefile::FindTarget(const std::string& name,
{ {
if (!excludeAliases) if (!excludeAliases)
{ {
std::map<std::string, cmTarget*>::const_iterator i TargetMap::const_iterator i = this->AliasTargets.find(name);
= this->AliasTargets.find(name);
if (i != this->AliasTargets.end()) if (i != this->AliasTargets.end())
{ {
return i->second; return i->second;
@ -4134,7 +4133,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name,
{ {
// Look for an imported target. These take priority because they // Look for an imported target. These take priority because they
// are more local in scope and do not have to be globally unique. // are more local in scope and do not have to be globally unique.
std::map<std::string, cmTarget*>::const_iterator TargetMap::const_iterator
imported = this->ImportedTargets.find(name); imported = this->ImportedTargets.find(name);
if(imported != this->ImportedTargets.end()) if(imported != this->ImportedTargets.end())
{ {

View File

@ -909,7 +909,12 @@ protected:
// libraries, classes, and executables // libraries, classes, and executables
mutable cmTargets Targets; mutable cmTargets Targets;
std::map<std::string, cmTarget*> AliasTargets; #if defined(CMAKE_BUILD_WITH_CMAKE)
typedef cmsys::hash_map<std::string, cmTarget*> TargetMap;
#else
typedef std::map<std::string, cmTarget*> TargetMap;
#endif
TargetMap AliasTargets;
cmGeneratorTargetsType GeneratorTargets; cmGeneratorTargetsType GeneratorTargets;
std::vector<cmSourceFile*> SourceFiles; std::vector<cmSourceFile*> SourceFiles;
@ -1010,7 +1015,7 @@ private:
friend class cmMakefileCall; friend class cmMakefileCall;
std::vector<cmTarget*> ImportedTargetsOwned; std::vector<cmTarget*> ImportedTargetsOwned;
std::map<std::string, cmTarget*> ImportedTargets; TargetMap ImportedTargets;
// Internal policy stack management. // Internal policy stack management.
void PushPolicy(bool weak = false, void PushPolicy(bool weak = false,