cmComputeLinkInformation: Port result API to cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-10-08 00:51:05 +02:00
parent c7645fca12
commit 7c8236efa7
3 changed files with 11 additions and 15 deletions

View File

@ -471,7 +471,7 @@ std::vector<std::string> const& cmComputeLinkInformation::GetFrameworkPaths()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::set<cmTarget const*> const& const std::set<const cmGeneratorTarget*>&
cmComputeLinkInformation::GetSharedLibrariesLinked() cmComputeLinkInformation::GetSharedLibrariesLinked()
{ {
return this->SharedLibrariesLinked; return this->SharedLibrariesLinked;
@ -1093,7 +1093,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
// Keep track of shared library targets linked. // Keep track of shared library targets linked.
if(target->GetType() == cmTarget::SHARED_LIBRARY) if(target->GetType() == cmTarget::SHARED_LIBRARY)
{ {
this->SharedLibrariesLinked.insert(target->Target); this->SharedLibrariesLinked.insert(target);
} }
// Handle case of an imported shared library with no soname. // Handle case of an imported shared library with no soname.

View File

@ -19,7 +19,6 @@
class cmake; class cmake;
class cmGlobalGenerator; class cmGlobalGenerator;
class cmMakefile; class cmMakefile;
class cmTarget;
class cmGeneratorTarget; class cmGeneratorTarget;
class cmOrderDirectories; class cmOrderDirectories;
@ -57,7 +56,7 @@ public:
void GetRPath(std::vector<std::string>& runtimeDirs, bool for_install); void GetRPath(std::vector<std::string>& runtimeDirs, bool for_install);
std::string GetRPathString(bool for_install); std::string GetRPathString(bool for_install);
std::string GetChrpathString(); std::string GetChrpathString();
std::set<cmTarget const*> const& GetSharedLibrariesLinked(); std::set<cmGeneratorTarget const*> const& GetSharedLibrariesLinked();
std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; } std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; }
std::string GetRPathLinkString(); std::string GetRPathLinkString();
@ -71,7 +70,7 @@ private:
std::vector<std::string> Depends; std::vector<std::string> Depends;
std::vector<std::string> FrameworkPaths; std::vector<std::string> FrameworkPaths;
std::vector<std::string> RuntimeSearchPath; std::vector<std::string> RuntimeSearchPath;
std::set<cmTarget const*> SharedLibrariesLinked; std::set<cmGeneratorTarget const*> SharedLibrariesLinked;
// Context information. // Context information.
cmGeneratorTarget const* Target; cmGeneratorTarget const* Target;

View File

@ -563,12 +563,12 @@ cmInstallTargetGenerator
std::map<std::string, std::string> install_name_remap; std::map<std::string, std::string> install_name_remap;
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config)) if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config))
{ {
std::set<cmTarget const*> const& sharedLibs std::set<cmGeneratorTarget const*> const& sharedLibs
= cli->GetSharedLibrariesLinked(); = cli->GetSharedLibrariesLinked();
for(std::set<cmTarget const*>::const_iterator j = sharedLibs.begin(); for(std::set<cmGeneratorTarget const*>::const_iterator j
j != sharedLibs.end(); ++j) = sharedLibs.begin(); j != sharedLibs.end(); ++j)
{ {
cmTarget const* tgt = *j; cmGeneratorTarget const* tgt = *j;
// The install_name of an imported target does not change. // The install_name of an imported target does not change.
if(tgt->IsImported()) if(tgt->IsImported())
@ -576,20 +576,17 @@ cmInstallTargetGenerator
continue; continue;
} }
cmGeneratorTarget *gtgt = tgt->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(tgt);
// If the build tree and install tree use different path // If the build tree and install tree use different path
// components of the install_name field then we need to create a // components of the install_name field then we need to create a
// mapping to be applied after installation. // mapping to be applied after installation.
std::string for_build = gtgt->GetInstallNameDirForBuildTree(config); std::string for_build = tgt->GetInstallNameDirForBuildTree(config);
std::string for_install = gtgt->GetInstallNameDirForInstallTree(); std::string for_install = tgt->GetInstallNameDirForInstallTree();
if(for_build != for_install) if(for_build != for_install)
{ {
// The directory portions differ. Append the filename to // The directory portions differ. Append the filename to
// create the mapping. // create the mapping.
std::string fname = std::string fname =
this->GetInstallFilename(tgt, config, NameSO); this->GetInstallFilename(tgt->Target, config, NameSO);
// Map from the build-tree install_name. // Map from the build-tree install_name.
for_build += fname; for_build += fname;