summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-08-04 17:19:41 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-08-05 16:20:43 (GMT)
commit41abdc17df99662a8e99ba895050dbc8c0e34b8e (patch)
treeca27f70ba5884758eb78d64df23d9202c69c7a1f /Source
parent1aa13f2b58e477095f76d28a8d9bb1b83a9dd1f5 (diff)
downloadCMake-41abdc17df99662a8e99ba895050dbc8c0e34b8e.zip
CMake-41abdc17df99662a8e99ba895050dbc8c0e34b8e.tar.gz
CMake-41abdc17df99662a8e99ba895050dbc8c0e34b8e.tar.bz2
cmGeneratorTarget: Move GetSOName from cmTarget..
Diffstat (limited to 'Source')
-rw-r--r--Source/cmComputeLinkInformation.cxx16
-rw-r--r--Source/cmExportFileGenerator.cxx2
-rw-r--r--Source/cmGeneratorExpressionNode.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx43
-rw-r--r--Source/cmGeneratorTarget.h3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmTarget.cxx57
-rw-r--r--Source/cmTarget.h18
8 files changed, 73 insertions, 70 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index e63b44f..72db6f8 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -756,15 +756,16 @@ 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)
{
- cmGeneratorTarget *gtgt = tgt->GetMakefile()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(tgt);
+ gtgt = tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt);
+
lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary);
this->AddLibraryRuntimeInfo(lib, tgt);
}
@@ -790,9 +791,9 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
}
if(order)
{
- if(tgt)
+ if(gtgt)
{
- std::string soName = tgt->GetSOName(this->Config);
+ std::string soName = gtgt->GetSOName(this->Config);
const char* soname = soName.empty()? 0 : soName.c_str();
order->AddRuntimeLibrary(lib, soname);
}
@@ -1804,7 +1805,10 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath,
// Try to get the soname of the library. Only files with this name
// could possibly conflict.
- std::string soName = target->GetSOName(this->Config);
+ cmGeneratorTarget *gtgt = target->GetMakefile()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ std::string soName = gtgt->GetSOName(this->Config);
const char* soname = soName.empty()? 0 : soName.c_str();
// Include this library in the runtime path ordering.
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index a33cd59..3aa2b65 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -895,7 +895,7 @@ cmExportFileGenerator
value = this->InstallNameDir(target->Target, config);
}
prop = "IMPORTED_SONAME";
- value += target->Target->GetSOName(config);
+ value += target->GetSOName(config);
}
else
{
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index f3527ff..c0485db 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1584,7 +1584,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
}
std::string result = target->Target->GetDirectory(context->Config);
result += "/";
- result += target->Target->GetSOName(context->Config);
+ result += target->GetSOName(context->Config);
return result;
}
};
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index bd57b3d..e17df9e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -650,6 +650,49 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
}
//----------------------------------------------------------------------------
+std::string cmGeneratorTarget::GetSOName(const std::string& config) const
+{
+ if(this->Target->IsImported())
+ {
+ // Lookup the imported soname.
+ if(cmTarget::ImportInfo const* info = this->Target->GetImportInfo(config))
+ {
+ if(info->NoSOName)
+ {
+ // The imported library has no builtin soname so the name
+ // searched at runtime will be just the filename.
+ return cmSystemTools::GetFilenameName(info->Location);
+ }
+ else
+ {
+ // Use the soname given if any.
+ if(info->SOName.find("@rpath/") == 0)
+ {
+ return info->SOName.substr(6);
+ }
+ return info->SOName;
+ }
+ }
+ else
+ {
+ return "";
+ }
+ }
+ else
+ {
+ // Compute the soname that will be built.
+ std::string name;
+ std::string soName;
+ std::string realName;
+ std::string impName;
+ std::string pdbName;
+ this->Target->GetLibraryNames(name, soName, realName,
+ impName, pdbName, config);
+ return soName;
+ }
+}
+
+//----------------------------------------------------------------------------
std::string
cmGeneratorTarget::GetModuleDefinitionFile(const std::string& config) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index a584c71..8e5c2ab 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -90,6 +90,9 @@ public:
bool realname) const;
std::string NormalGetRealName(const std::string& config) const;
+ /** Get the soname of the target. Allowed only for a shared library. */
+ std::string GetSOName(const std::string& config) const;
+
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 7dea107..8cb59f8 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2345,7 +2345,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
install_name += install_name_dir;
install_name += "/";
}
- install_name += target.GetSOName(configName);
+ install_name += gtgt->GetSOName(configName);
if((realName != soName) || install_name_dir.empty())
{
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index cf33791..54f9cf0 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -69,21 +69,6 @@ struct cmTarget::OutputInfo
};
//----------------------------------------------------------------------------
-struct cmTarget::ImportInfo
-{
- ImportInfo(): NoSOName(false), Multiplicity(0) {}
- bool NoSOName;
- int Multiplicity;
- std::string Location;
- std::string SOName;
- std::string ImportLibrary;
- std::string Languages;
- std::string Libraries;
- std::string LibrariesProp;
- std::string SharedDeps;
-};
-
-//----------------------------------------------------------------------------
struct cmTarget::CompileInfo
{
std::string CompilePdbDir;
@@ -3602,48 +3587,6 @@ bool cmTarget::HasSOName(const std::string& config) const
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetSOName(const std::string& config) const
-{
- if(this->IsImported())
- {
- // Lookup the imported soname.
- if(cmTarget::ImportInfo const* info = this->GetImportInfo(config))
- {
- if(info->NoSOName)
- {
- // The imported library has no builtin soname so the name
- // searched at runtime will be just the filename.
- return cmSystemTools::GetFilenameName(info->Location);
- }
- else
- {
- // Use the soname given if any.
- if(info->SOName.find("@rpath/") == 0)
- {
- return info->SOName.substr(6);
- }
- return info->SOName;
- }
- }
- else
- {
- return "";
- }
- }
- else
- {
- // Compute the soname that will be built.
- std::string name;
- std::string soName;
- std::string realName;
- std::string impName;
- std::string pdbName;
- this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
- return soName;
- }
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const
{
bool install_name_is_rpath = false;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index f567d50..389f9cd 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -411,9 +411,6 @@ public:
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const std::string& config) const;
- /** Get the soname of the target. Allowed only for a shared library. */
- std::string GetSOName(const std::string& config) const;
-
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
@@ -768,7 +765,20 @@ private:
std::string& out) const;
// Cache import information from properties for each configuration.
- struct ImportInfo;
+ struct ImportInfo
+ {
+ ImportInfo(): NoSOName(false), Multiplicity(0) {}
+ bool NoSOName;
+ int Multiplicity;
+ std::string Location;
+ std::string SOName;
+ std::string ImportLibrary;
+ std::string Languages;
+ std::string Libraries;
+ std::string LibrariesProp;
+ std::string SharedDeps;
+ };
+
ImportInfo const* GetImportInfo(const std::string& config) const;
void ComputeImportInfo(std::string const& desired_config,
ImportInfo& info) const;