From 8d2e3e53b903b1ee38292b6bcdf3e4eeb5399a05 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 9 Oct 2015 23:50:36 +0200 Subject: cmGeneratorTarget: Move HasImplibGNUtoMS from cmTarget. --- Source/cmExportBuildFileGenerator.cxx | 2 +- Source/cmGeneratorTarget.cxx | 21 +++++++++++++++++++++ Source/cmGeneratorTarget.h | 8 ++++++++ Source/cmInstallTargetGenerator.cxx | 8 ++++---- Source/cmMakefileExecutableTargetGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 2 +- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmTarget.cxx | 20 -------------------- Source/cmTarget.h | 8 -------- 9 files changed, 37 insertions(+), 36 deletions(-) diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index fed0dbc..400fa17 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -217,7 +217,7 @@ cmExportBuildFileGenerator std::string prop = "IMPORTED_IMPLIB"; prop += suffix; std::string value = target->GetFullPath(config, true); - target->Target->GetImplibGNUtoMS(value, value, + target->GetImplibGNUtoMS(value, value, "${CMAKE_IMPORT_LIBRARY_SUFFIX}"); properties[prop] = value; } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index c24126f..90acca6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5483,3 +5483,24 @@ cmGeneratorTarget::GetPDBDirectory(const std::string& config) const } return ""; } + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::HasImplibGNUtoMS() const +{ + return this->Target->HasImportLibrary() + && this->GetPropertyAsBool("GNUtoMS"); +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& gnuName, + std::string& out, const char* newExt) const +{ + if(this->HasImplibGNUtoMS() && + gnuName.size() > 6 && gnuName.substr(gnuName.size()-6) == ".dll.a") + { + out = gnuName.substr(0, gnuName.size()-6); + out += newExt? newExt : ".lib"; + return true; + } + return false; +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index b3519de..e2be249 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -390,6 +390,14 @@ public: ///! Return the preferred linker language for this target std::string GetLinkerLanguage(const std::string& config = "") const; + /** Does this target have a GNU implib to convert to MS format? */ + bool HasImplibGNUtoMS() const; + + /** Convert the given GNU import library name (.dll.a) to a name with a new + extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */ + bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, + const char* newExt = 0) const; + struct SourceFileFlags GetTargetSourceFileFlags(const cmSourceFile* sf) const; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index b3bc95a..c2a18af 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -135,7 +135,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, filesFrom.push_back(from1); filesTo.push_back(to1); std::string targetNameImportLib; - if(this->Target->Target->GetImplibGNUtoMS(targetNameImport, + if(this->Target->GetImplibGNUtoMS(targetNameImport, targetNameImportLib)) { filesFrom.push_back(fromDirConfig + targetNameImportLib); @@ -199,7 +199,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, filesFrom.push_back(from1); filesTo.push_back(to1); std::string targetNameImportLib; - if(this->Target->Target->GetImplibGNUtoMS(targetNameImport, + if(this->Target->GetImplibGNUtoMS(targetNameImport, targetNameImportLib)) { filesFrom.push_back(fromDirConfig + targetNameImportLib); @@ -387,7 +387,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target, if(nameType == NameImplib) { // Use the import library name. - if(!target->GetImplibGNUtoMS(targetNameImport, fname, + if(!gtgt->GetImplibGNUtoMS(targetNameImport, fname, "${CMAKE_IMPORT_LIBRARY_SUFFIX}")) { fname = targetNameImport; @@ -416,7 +416,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target, if(nameType == NameImplib) { // Use the import library name. - if(!target->GetImplibGNUtoMS(targetNameImport, fname, + if(!gtgt->GetImplibGNUtoMS(targetNameImport, fname, "${CMAKE_IMPORT_LIBRARY_SUFFIX}")) { fname = targetNameImport; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index f6b907e..de84f89 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -259,7 +259,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); std::string implib; - if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib)) + if(this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport, implib)) { exeCleanFiles.push_back(this->Convert(implib, cmLocalGenerator::START_OUTPUT, diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 3b3f63e..2b019be 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -410,7 +410,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); std::string implib; - if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib)) + if(this->GeneratorTarget->GetImplibGNUtoMS(targetFullPathImport, implib)) { libCleanFiles.push_back(this->Convert(implib, cmLocalGenerator::START_OUTPUT, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f17f66d..5f9367d 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1517,7 +1517,7 @@ std::string cmMakefileTargetGenerator::GetLinkRule( const std::string& linkRuleVar) { std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar); - if(this->Target->HasImplibGNUtoMS()) + if(this->GeneratorTarget->HasImplibGNUtoMS()) { std::string ruleVar = "CMAKE_"; ruleVar += this->GeneratorTarget->GetLinkerLanguage(this->ConfigName); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index bebdd77..b16bc30 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2199,26 +2199,6 @@ void cmTarget::ComputeVersionedName(std::string& vName, } //---------------------------------------------------------------------------- -bool cmTarget::HasImplibGNUtoMS() const -{ - return this->HasImportLibrary() && this->GetPropertyAsBool("GNUtoMS"); -} - -//---------------------------------------------------------------------------- -bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName, - std::string& out, const char* newExt) const -{ - if(this->HasImplibGNUtoMS() && - gnuName.size() > 6 && gnuName.substr(gnuName.size()-6) == ".dll.a") - { - out = gnuName.substr(0, gnuName.size()-6); - out += newExt? newExt : ".lib"; - return true; - } - return false; -} - -//---------------------------------------------------------------------------- void cmTarget::SetPropertyDefault(const std::string& property, const char* default_value) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 3bb1ccd..500b598 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -240,14 +240,6 @@ public: void GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; - /** Does this target have a GNU implib to convert to MS format? */ - bool HasImplibGNUtoMS() const; - - /** Convert the given GNU import library name (.dll.a) to a name with a new - extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */ - bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, - const char* newExt = 0) const; - // Get the properties cmPropertyMap &GetProperties() const { return this->Properties; } -- cgit v0.12