summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-08 00:41:15 +0200
committerStephen Kelly <steveire@gmail.com>2015-10-10 11:14:31 +0200
commit064c2488119269e88422ea444f87bdd44c4f6589 (patch)
tree41e5dce9a4c0d1bcfd564889f71c1ccbf6474e72
parent3e428fdcb4640411f8cbc4adc42c30b9c8b8032e (diff)
downloadcmake-064c2488119269e88422ea444f87bdd44c4f6589.tar.gz
cmComputeLinkDepends: Port some API to cmGeneratorTarget.
-rw-r--r--Source/cmComputeLinkDepends.cxx30
-rw-r--r--Source/cmComputeLinkDepends.h3
-rw-r--r--Source/cmComputeLinkInformation.cxx33
-rw-r--r--Source/cmComputeLinkInformation.h4
4 files changed, 31 insertions, 39 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 1b5c9f417d..a9e8cfc2b1 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -268,7 +268,7 @@ cmComputeLinkDepends::Compute()
{
int i = *li;
LinkEntry const& e = this->EntryList[i];
- cmTarget const* t = e.Target;
+ cmGeneratorTarget const* t = e.Target;
// Entries that we know the linker will re-use do not need to be repeated.
bool uniquify = t && t->GetType() == cmTarget::SHARED_LIBRARY;
if(!uniquify || emmitted.insert(i).second)
@@ -320,7 +320,8 @@ int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
int index = lei->second;
LinkEntry& entry = this->EntryList[index];
entry.Item = item;
- entry.Target = item.Target;
+ entry.Target =
+ item.Target ? this->GlobalGenerator->GetGeneratorTarget(item.Target) : 0;
entry.IsFlag = (!entry.Target && item[0] == '-' && item[1] != 'l' &&
item.substr(0, 10) != "-framework");
@@ -362,11 +363,9 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
// Follow the item's dependencies.
if(entry.Target)
{
- cmGeneratorTarget* gtgt =
- this->GlobalGenerator->GetGeneratorTarget(entry.Target);
// Follow the target dependencies.
if(cmLinkInterface const* iface =
- gtgt->GetLinkInterface(this->Config, this->Target->Target))
+ entry.Target->GetLinkInterface(this->Config, this->Target->Target))
{
const bool isIface =
entry.Target->GetType() == cmTarget::INTERFACE_LIBRARY;
@@ -444,7 +443,9 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
// Initialize the item entry.
LinkEntry& entry = this->EntryList[lei->second];
entry.Item = dep.Item;
- entry.Target = dep.Item.Target;
+ entry.Target =
+ dep.Item.Target ?
+ this->GlobalGenerator->GetGeneratorTarget(dep.Item.Target) : 0;
// This item was added specifically because it is a dependent
// shared library. It may get special treatment
@@ -463,10 +464,8 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
// Target items may have their own dependencies.
if(entry.Target)
{
- cmGeneratorTarget* gtgt =
- this->GlobalGenerator->GetGeneratorTarget(entry.Target);
if(cmLinkInterface const* iface =
- gtgt->GetLinkInterface(this->Config, this->Target->Target))
+ entry.Target->GetLinkInterface(this->Config, this->Target->Target))
{
// Follow public and private dependencies transitively.
this->FollowSharedDeps(index, iface, true);
@@ -639,15 +638,16 @@ cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index,
const std::string& name)
{
// Look for a target in the scope of the depender.
- cmTarget const* from = this->Target->Target;
+ cmGeneratorTarget const* from = this->Target;
if(depender_index >= 0)
{
- if(cmTarget const* depender = this->EntryList[depender_index].Target)
+ if(cmGeneratorTarget const* depender =
+ this->EntryList[depender_index].Target)
{
from = depender;
}
}
- return from->FindTargetToLink(name);
+ return from->Target->FindTargetToLink(name);
}
//----------------------------------------------------------------------------
@@ -934,12 +934,10 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
int count = 2;
for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
- if(cmTarget const* target = this->EntryList[*ni].Target)
+ if(cmGeneratorTarget const* target = this->EntryList[*ni].Target)
{
- cmGeneratorTarget* gtgt =
- this->GlobalGenerator->GetGeneratorTarget(target);
if(cmLinkInterface const* iface =
- gtgt->GetLinkInterface(this->Config, this->Target->Target))
+ target->GetLinkInterface(this->Config, this->Target->Target))
{
if(iface->Multiplicity > count)
{
diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h
index 2cbb43013b..5ad87147d1 100644
--- a/Source/cmComputeLinkDepends.h
+++ b/Source/cmComputeLinkDepends.h
@@ -23,7 +23,6 @@ class cmComputeComponentGraph;
class cmGlobalGenerator;
class cmMakefile;
class cmGeneratorTarget;
-class cmTarget;
class cmake;
/** \class cmComputeLinkDepends
@@ -40,7 +39,7 @@ public:
struct LinkEntry
{
std::string Item;
- cmTarget const* Target;
+ cmGeneratorTarget const* Target;
bool IsSharedDep;
bool IsFlag;
LinkEntry(): Item(), Target(0), IsSharedDep(false), IsFlag(false) {}
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 937154647c..7e3461165f 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -632,11 +632,11 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
//----------------------------------------------------------------------------
void cmComputeLinkInformation::AddItem(std::string const& item,
- cmTarget const* tgt)
+ cmGeneratorTarget const* tgt)
{
// Compute the proper name to use to link this library.
const std::string& config = this->Config;
- bool impexe = (tgt && tgt->IsExecutableWithExports());
+ bool impexe = (tgt && tgt->Target->IsExecutableWithExports());
if(impexe && !this->UseImportLibrary && !this->LoaderFlag)
{
// Skip linking to executables on platforms with no import
@@ -644,9 +644,8 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
return;
}
- if(tgt && tgt->IsLinkable())
+ if(tgt && tgt->Target->IsLinkable())
{
- cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
// This is a CMake target. Ask the target for its real name.
if(impexe && this->LoaderFlag)
{
@@ -656,10 +655,10 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
std::string linkItem;
linkItem = this->LoaderFlag;
- std::string exe = gtgt->GetFullPath(config, this->UseImportLibrary,
+ std::string exe = tgt->GetFullPath(config, this->UseImportLibrary,
true);
linkItem += exe;
- this->Items.push_back(Item(linkItem, true, tgt));
+ this->Items.push_back(Item(linkItem, true, tgt->Target));
this->Depends.push_back(exe);
}
else if(tgt->GetType() == cmTarget::INTERFACE_LIBRARY)
@@ -667,7 +666,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
// Add the interface library as an item so it can be considered as part
// of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore
// this for the actual link line.
- this->Items.push_back(Item(std::string(), true, tgt));
+ this->Items.push_back(Item(std::string(), true, tgt->Target));
}
else
{
@@ -677,15 +676,15 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
(impexe || tgt->GetType() == cmTarget::SHARED_LIBRARY));
// Pass the full path to the target file.
- std::string lib = gtgt->GetFullPath(config, implib, true);
+ std::string lib = tgt->GetFullPath(config, implib, true);
if(!this->LinkDependsNoShared ||
tgt->GetType() != cmTarget::SHARED_LIBRARY)
{
this->Depends.push_back(lib);
}
- this->AddTargetItem(lib, tgt);
- this->AddLibraryRuntimeInfo(lib, tgt);
+ this->AddTargetItem(lib, tgt->Target);
+ this->AddLibraryRuntimeInfo(lib, tgt->Target);
}
}
else
@@ -716,7 +715,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
//----------------------------------------------------------------------------
void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
- cmTarget const* tgt)
+ const cmGeneratorTarget* tgt)
{
// If dropping shared library dependencies, ignore them.
if(this->SharedDependencyMode == SharedDepModeNone)
@@ -760,18 +759,14 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
return;
}
- cmGeneratorTarget *gtgt = 0;
-
// Get a full path to the dependent shared library.
// Add it to the runtime path computation so that the target being
// linked will be able to find it.
std::string lib;
if(tgt)
{
- gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt);
-
- lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary);
- this->AddLibraryRuntimeInfo(lib, tgt);
+ lib = tgt->GetFullPath(this->Config, this->UseImportLibrary);
+ this->AddLibraryRuntimeInfo(lib, tgt->Target);
}
else
{
@@ -795,9 +790,9 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
}
if(order)
{
- if(gtgt)
+ if(tgt)
{
- std::string soName = gtgt->GetSOName(this->Config);
+ std::string soName = tgt->GetSOName(this->Config);
const char* soname = soName.empty()? 0 : soName.c_str();
order->AddRuntimeLibrary(lib, soname);
}
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index 8b8357459f..b1e7e46809 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -62,8 +62,8 @@ public:
std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; }
std::string GetRPathLinkString();
private:
- void AddItem(std::string const& item, cmTarget const* tgt);
- void AddSharedDepItem(std::string const& item, cmTarget const* tgt);
+ void AddItem(std::string const& item, const cmGeneratorTarget* tgt);
+ void AddSharedDepItem(std::string const& item, cmGeneratorTarget const* tgt);
// Output information.
ItemVector Items;