From f0aa660772565545cbcda9ed8ae946b8d5097416 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 4 Aug 2015 19:19:45 +0200 Subject: [PATCH] cmGeneratorTarget: Move HasSOName from cmTarget. --- Source/cmExportFileGenerator.cxx | 2 +- Source/cmGeneratorTarget.cxx | 14 +++++++++++++- Source/cmGeneratorTarget.h | 3 +++ Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmTarget.cxx | 11 ----------- Source/cmTarget.h | 3 --- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 8a2cf4b95..e3652c56e 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -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")) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 31c2df1cf..2b3ebee9d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -656,6 +656,18 @@ void cmGeneratorTarget::GetSourceFiles(std::vector &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, diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 7fb7c3282..925426544 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -160,6 +160,9 @@ public: std::vector 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. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index b44848caf..d7ae36dd0 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -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; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 26273eecf..7d0dc4990 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -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(); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 5d86091c1..2586b3198 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -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; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 60fe7e49c..e1b3e9481 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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 { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 15dfb4a00..e89a212b6 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -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;