summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-25 11:43:00 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-27 06:44:24 (GMT)
commita67231ac114235f0af4673235c4c07fa896c8ab6 (patch)
tree0c23756461e3a26b8a27fc3e340c928b1ca7f62a /Source
parentd566f39a640297114bd3ad933bb3279440b2f38f (diff)
downloadCMake-a67231ac114235f0af4673235c4c07fa896c8ab6.zip
CMake-a67231ac114235f0af4673235c4c07fa896c8ab6.tar.gz
CMake-a67231ac114235f0af4673235c4c07fa896c8ab6.tar.bz2
cmTarget: Implement ALIAS in terms of name mapping
Remove mapping to cmTarget.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmAddExecutableCommand.cxx2
-rw-r--r--Source/cmAddLibraryCommand.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx10
-rw-r--r--Source/cmGlobalGenerator.h14
-rw-r--r--Source/cmMakefile.cxx13
-rw-r--r--Source/cmMakefile.h4
6 files changed, 20 insertions, 25 deletions
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index 47f6592..a84bb9d 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -192,7 +192,7 @@ bool cmAddExecutableCommand
this->SetError(e.str());
return false;
}
- this->Makefile->AddAlias(exename, aliasedTarget);
+ this->Makefile->AddAlias(exename, aliasedName);
return true;
}
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index e0adee3..5296cbb 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -314,7 +314,7 @@ bool cmAddLibraryCommand
this->SetError(e.str());
return false;
}
- this->Makefile->AddAlias(libName, aliasedTarget);
+ this->Makefile->AddAlias(libName, aliasedName);
return true;
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 215d63f..47d254e 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2167,9 +2167,10 @@ cmGlobalGenerator::FindLocalGenerator(const std::string& start_dir) const
}
//----------------------------------------------------------------------------
-void cmGlobalGenerator::AddAlias(const std::string& name, cmTarget *tgt)
+void cmGlobalGenerator::AddAlias(const std::string& name,
+ std::string const& tgtName)
{
- this->AliasTargets[name] = tgt;
+ this->AliasTargets[name] = tgtName;
}
//----------------------------------------------------------------------------
@@ -2220,10 +2221,11 @@ cmGlobalGenerator::FindTarget(const std::string& name,
{
if (!excludeAliases)
{
- TargetMap::const_iterator ai = this->AliasTargets.find(name);
+ std::map<std::string, std::string>::const_iterator ai =
+ this->AliasTargets.find(name);
if (ai != this->AliasTargets.end())
{
- return ai->second;
+ return this->FindTargetImpl(ai->second);
}
}
if (cmTarget* tgt = this->FindTargetImpl(name))
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 5d4ce08..419cada 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -254,7 +254,7 @@ public:
cmTarget* FindTarget(const std::string& name,
bool excludeAliases = false) const;
- void AddAlias(const std::string& name, cmTarget *tgt);
+ void AddAlias(const std::string& name, const std::string& tgtName);
bool IsAlias(const std::string& name) const;
/** Determine if a name resolves to a framework on disk or a built target
@@ -427,17 +427,7 @@ protected:
std::map<std::string, cmExportBuildFileGenerator*> BuildExportSets;
std::map<std::string, cmExportBuildFileGenerator*> BuildExportExportSets;
- // All targets in the entire project.
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
- typedef std::unordered_map<std::string, cmTarget*> TargetMap;
-#else
- typedef cmsys::hash_map<std::string, cmTarget*> TargetMap;
-#endif
-#else
- typedef std::map<std::string,cmTarget *> TargetMap;
-#endif
- TargetMap AliasTargets;
+ std::map<std::string, std::string> AliasTargets;
cmTarget* FindTargetImpl(std::string const& name) const;
cmTarget* FindImportedTargetImpl(std::string const& name) const;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index d9d773d..8f72f67 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2036,10 +2036,11 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name,
}
-void cmMakefile::AddAlias(const std::string& lname, cmTarget *tgt)
+void cmMakefile::AddAlias(const std::string& lname,
+ std::string const& tgtName)
{
- this->AliasTargets[lname] = tgt;
- this->GetGlobalGenerator()->AddAlias(lname, tgt);
+ this->AliasTargets[lname] = tgtName;
+ this->GetGlobalGenerator()->AddAlias(lname, tgtName);
}
cmTarget* cmMakefile::AddLibrary(const std::string& lname,
@@ -4024,10 +4025,12 @@ cmTarget* cmMakefile::FindTarget(const std::string& name,
{
if (!excludeAliases)
{
- TargetMap::const_iterator i = this->AliasTargets.find(name);
+ std::map<std::string, std::string>::const_iterator i =
+ this->AliasTargets.find(name);
if (i != this->AliasTargets.end())
{
- return i->second;
+ cmTargets::iterator ai = this->Targets.find(i->second);
+ return &ai->second;
}
}
cmTargets::iterator i = this->Targets.find( name );
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index f3dbb74..35dd3c6 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -283,7 +283,7 @@ public:
cmTarget* AddLibrary(const std::string& libname, cmState::TargetType type,
const std::vector<std::string> &srcs,
bool excludeFromAll = false);
- void AddAlias(const std::string& libname, cmTarget *tgt);
+ void AddAlias(const std::string& libname, const std::string& tgt);
#if defined(CMAKE_BUILD_WITH_CMAKE)
/**
@@ -790,7 +790,7 @@ protected:
#else
typedef std::map<std::string, cmTarget*> TargetMap;
#endif
- TargetMap AliasTargets;
+ std::map<std::string, std::string> AliasTargets;
std::vector<cmSourceFile*> SourceFiles;
// Tests