Merge topic 'dev/hashmap-for-targets'
325599ca
cmGlobalGenerator: Store targets in hash mapsac4106c6
cmMakefile: Use a hashmap for imported targets
This commit is contained in:
commit
45f338e3d9
|
@ -2085,15 +2085,13 @@ cmGlobalGenerator::FindTarget(const std::string& name,
|
||||||
{
|
{
|
||||||
if (!excludeAliases)
|
if (!excludeAliases)
|
||||||
{
|
{
|
||||||
std::map<std::string, cmTarget*>::const_iterator ai
|
TargetMap::const_iterator ai = this->AliasTargets.find(name);
|
||||||
= this->AliasTargets.find(name);
|
|
||||||
if (ai != this->AliasTargets.end())
|
if (ai != this->AliasTargets.end())
|
||||||
{
|
{
|
||||||
return ai->second;
|
return ai->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::map<std::string,cmTarget *>::const_iterator i =
|
TargetMap::const_iterator i = this->TotalTargets.find ( name );
|
||||||
this->TotalTargets.find ( name );
|
|
||||||
if ( i != this->TotalTargets.end() )
|
if ( i != this->TotalTargets.end() )
|
||||||
{
|
{
|
||||||
return i->second;
|
return i->second;
|
||||||
|
@ -2874,7 +2872,7 @@ void cmGlobalGenerator::WriteSummary()
|
||||||
cmGeneratedFileStream fout(fname.c_str());
|
cmGeneratedFileStream fout(fname.c_str());
|
||||||
|
|
||||||
// Generate summary information files for each target.
|
// Generate summary information files for each target.
|
||||||
for(std::map<std::string,cmTarget *>::const_iterator ti =
|
for(TargetMap::const_iterator ti =
|
||||||
this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
|
this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
|
||||||
{
|
{
|
||||||
if ((ti->second)->GetType() == cmTarget::INTERFACE_LIBRARY)
|
if ((ti->second)->GetType() == cmTarget::INTERFACE_LIBRARY)
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmGeneratorExpression.h"
|
#include "cmGeneratorExpression.h"
|
||||||
|
|
||||||
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
|
# include <cmsys/hash_map.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
class cmake;
|
class cmake;
|
||||||
class cmGeneratorTarget;
|
class cmGeneratorTarget;
|
||||||
class cmGeneratorExpressionEvaluationFile;
|
class cmGeneratorExpressionEvaluationFile;
|
||||||
|
@ -389,9 +393,14 @@ protected:
|
||||||
cmTargetManifest TargetManifest;
|
cmTargetManifest TargetManifest;
|
||||||
|
|
||||||
// All targets in the entire project.
|
// All targets in the entire project.
|
||||||
std::map<std::string,cmTarget *> TotalTargets;
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
std::map<std::string,cmTarget *> AliasTargets;
|
typedef cmsys::hash_map<std::string, cmTarget*> TargetMap;
|
||||||
std::map<std::string,cmTarget *> ImportedTargets;
|
#else
|
||||||
|
typedef std::map<std::string,cmTarget *> TargetMap;
|
||||||
|
#endif
|
||||||
|
TargetMap TotalTargets;
|
||||||
|
TargetMap AliasTargets;
|
||||||
|
TargetMap ImportedTargets;
|
||||||
std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
|
std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
|
||||||
|
|
||||||
virtual const char* GetPredefinedTargetsFolder();
|
virtual const char* GetPredefinedTargetsFolder();
|
||||||
|
|
|
@ -341,7 +341,7 @@ void cmGlobalVisualStudio8Generator::Generate()
|
||||||
if(this->AddCheckTarget())
|
if(this->AddCheckTarget())
|
||||||
{
|
{
|
||||||
// All targets depend on the build-system check target.
|
// All targets depend on the build-system check target.
|
||||||
for(std::map<std::string,cmTarget *>::const_iterator
|
for(TargetMap::const_iterator
|
||||||
ti = this->TotalTargets.begin();
|
ti = this->TotalTargets.begin();
|
||||||
ti != this->TotalTargets.end(); ++ti)
|
ti != this->TotalTargets.end(); ++ti)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1219,7 +1219,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
||||||
void cmGlobalXCodeGenerator::ForceLinkerLanguages()
|
void cmGlobalXCodeGenerator::ForceLinkerLanguages()
|
||||||
{
|
{
|
||||||
// This makes sure all targets link using the proper language.
|
// This makes sure all targets link using the proper language.
|
||||||
for(std::map<std::string, cmTarget*>::const_iterator
|
for(TargetMap::const_iterator
|
||||||
ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
|
ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
|
||||||
{
|
{
|
||||||
this->ForceLinkerLanguage(*ti->second);
|
this->ForceLinkerLanguage(*ti->second);
|
||||||
|
|
|
@ -3858,8 +3858,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;
|
||||||
|
@ -4081,7 +4080,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())
|
||||||
{
|
{
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue