cmGeneratorTarget: Move HasSOName from cmTarget.

This commit is contained in:
Stephen Kelly 2015-08-04 19:19:45 +02:00
parent 766839c56d
commit f0aa660772
8 changed files with 20 additions and 19 deletions

View File

@ -889,7 +889,7 @@ cmExportFileGenerator
{
std::string prop;
std::string value;
if(target->Target->HasSOName(config))
if(target->HasSOName(config))
{
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{

View File

@ -656,6 +656,18 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
this->Target->GetSourceFiles(files, config);
}
//----------------------------------------------------------------------------
bool cmGeneratorTarget::HasSOName(const std::string& config) const
{
// soname is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
return ((this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY) &&
!this->GetPropertyAsBool("NO_SONAME") &&
this->Makefile->GetSONameFlag(
this->Target->GetLinkerLanguage(config)));
}
//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetSOName(const std::string& config) const
{
@ -1407,7 +1419,7 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name,
// Check for library version properties.
const char* version = this->GetProperty("VERSION");
const char* soversion = this->GetProperty("SOVERSION");
if(!this->Target->HasSOName(config) ||
if(!this->HasSOName(config) ||
this->Target->IsFrameworkOnApple())
{
// Versioning is supported only for shared libraries and modules,

View File

@ -160,6 +160,9 @@ public:
std::vector<cmSourceFile*> const*
GetSourceDepends(cmSourceFile const* sf) const;
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const std::string& config) const;
/**
* Flags for a given source file as used in this target. Typically assigned
* via SET_TARGET_PROPERTIES when the property is a list of source files.

View File

@ -1944,7 +1944,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
const char* version = target.GetProperty("VERSION");
const char* soversion = target.GetProperty("SOVERSION");
if(!target.HasSOName(configName) || target.IsFrameworkOnApple())
if(!gtgt->HasSOName(configName) || target.IsFrameworkOnApple())
{
version = 0;
soversion = 0;

View File

@ -653,7 +653,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
vars.Target = target.c_str();
vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
if (this->Target->HasSOName(this->ConfigName))
if (this->GeneratorTarget->HasSOName(this->ConfigName))
{
vars.SONameFlag = this->Makefile->GetSONameFlag(linkLanguage);
vars.TargetSOName= targetNameSO.c_str();

View File

@ -531,7 +531,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
vars["LANGUAGE_COMPILE_FLAGS"] = t;
}
if (target.HasSOName(cfgName))
if (this->GetGeneratorTarget()->HasSOName(cfgName))
{
vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage);
vars["SONAME"] = this->TargetNameSO;

View File

@ -3534,17 +3534,6 @@ std::string cmTarget::GetCompilePDBPath(const std::string& config) const
return dir + name;
}
//----------------------------------------------------------------------------
bool cmTarget::HasSOName(const std::string& config) const
{
// soname is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
return ((this->GetType() == cmTarget::SHARED_LIBRARY ||
this->GetType() == cmTarget::MODULE_LIBRARY) &&
!this->GetPropertyAsBool("NO_SONAME") &&
this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config)));
}
//----------------------------------------------------------------------------
bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const
{

View File

@ -386,9 +386,6 @@ public:
/** Get the path for the MSVC /Fd option for this target. */
std::string GetCompilePDBPath(const std::string& config="") const;
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const std::string& config) const;
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const std::string& config) const;