cmGeneratorTarget: Move GetSOName from cmTarget..
This commit is contained in:
parent
1aa13f2b58
commit
41abdc17df
@ -756,15 +756,16 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmGeneratorTarget *gtgt = 0;
|
||||||
|
|
||||||
// Get a full path to the dependent shared library.
|
// Get a full path to the dependent shared library.
|
||||||
// Add it to the runtime path computation so that the target being
|
// Add it to the runtime path computation so that the target being
|
||||||
// linked will be able to find it.
|
// linked will be able to find it.
|
||||||
std::string lib;
|
std::string lib;
|
||||||
if(tgt)
|
if(tgt)
|
||||||
{
|
{
|
||||||
cmGeneratorTarget *gtgt = tgt->GetMakefile()
|
gtgt = tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt);
|
||||||
->GetGlobalGenerator()
|
|
||||||
->GetGeneratorTarget(tgt);
|
|
||||||
lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary);
|
lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary);
|
||||||
this->AddLibraryRuntimeInfo(lib, tgt);
|
this->AddLibraryRuntimeInfo(lib, tgt);
|
||||||
}
|
}
|
||||||
@ -790,9 +791,9 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
|
|||||||
}
|
}
|
||||||
if(order)
|
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();
|
const char* soname = soName.empty()? 0 : soName.c_str();
|
||||||
order->AddRuntimeLibrary(lib, soname);
|
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
|
// Try to get the soname of the library. Only files with this name
|
||||||
// could possibly conflict.
|
// 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();
|
const char* soname = soName.empty()? 0 : soName.c_str();
|
||||||
|
|
||||||
// Include this library in the runtime path ordering.
|
// Include this library in the runtime path ordering.
|
||||||
|
@ -895,7 +895,7 @@ cmExportFileGenerator
|
|||||||
value = this->InstallNameDir(target->Target, config);
|
value = this->InstallNameDir(target->Target, config);
|
||||||
}
|
}
|
||||||
prop = "IMPORTED_SONAME";
|
prop = "IMPORTED_SONAME";
|
||||||
value += target->Target->GetSOName(config);
|
value += target->GetSOName(config);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1584,7 +1584,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
|
|||||||
}
|
}
|
||||||
std::string result = target->Target->GetDirectory(context->Config);
|
std::string result = target->Target->GetDirectory(context->Config);
|
||||||
result += "/";
|
result += "/";
|
||||||
result += target->Target->GetSOName(context->Config);
|
result += target->GetSOName(context->Config);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -649,6 +649,49 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
|
|||||||
this->Target->GetSourceFiles(files, config);
|
this->Target->GetSourceFiles(files, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
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
|
std::string
|
||||||
cmGeneratorTarget::GetModuleDefinitionFile(const std::string& config) const
|
cmGeneratorTarget::GetModuleDefinitionFile(const std::string& config) const
|
||||||
|
@ -90,6 +90,9 @@ public:
|
|||||||
bool realname) const;
|
bool realname) const;
|
||||||
std::string NormalGetRealName(const std::string& config) 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;
|
cmTarget* Target;
|
||||||
cmMakefile* Makefile;
|
cmMakefile* Makefile;
|
||||||
cmLocalGenerator* LocalGenerator;
|
cmLocalGenerator* LocalGenerator;
|
||||||
|
@ -2345,7 +2345,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
|
|||||||
install_name += install_name_dir;
|
install_name += install_name_dir;
|
||||||
install_name += "/";
|
install_name += "/";
|
||||||
}
|
}
|
||||||
install_name += target.GetSOName(configName);
|
install_name += gtgt->GetSOName(configName);
|
||||||
|
|
||||||
if((realName != soName) || install_name_dir.empty())
|
if((realName != soName) || install_name_dir.empty())
|
||||||
{
|
{
|
||||||
|
@ -68,21 +68,6 @@ struct cmTarget::OutputInfo
|
|||||||
std::string PdbDir;
|
std::string PdbDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
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
|
struct cmTarget::CompileInfo
|
||||||
{
|
{
|
||||||
@ -3601,48 +3586,6 @@ bool cmTarget::HasSOName(const std::string& config) const
|
|||||||
this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config)));
|
this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
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 cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const
|
||||||
{
|
{
|
||||||
|
@ -411,9 +411,6 @@ public:
|
|||||||
/** Whether this library has soname enabled and platform supports it. */
|
/** Whether this library has soname enabled and platform supports it. */
|
||||||
bool HasSOName(const std::string& config) const;
|
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. */
|
/** Whether this library has \@rpath and platform supports it. */
|
||||||
bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
|
bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
|
||||||
|
|
||||||
@ -768,7 +765,20 @@ private:
|
|||||||
std::string& out) const;
|
std::string& out) const;
|
||||||
|
|
||||||
// Cache import information from properties for each configuration.
|
// 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;
|
ImportInfo const* GetImportInfo(const std::string& config) const;
|
||||||
void ComputeImportInfo(std::string const& desired_config,
|
void ComputeImportInfo(std::string const& desired_config,
|
||||||
ImportInfo& info) const;
|
ImportInfo& info) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user