From b857f0d84b539056bc6a810161eb22e9b9baca43 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 16 Oct 2015 20:09:43 +0200 Subject: [PATCH] Use GetName from cmGeneratorTarget. --- Source/cmExportBuildFileGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 2 +- .../cmMakefileExecutableTargetGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 8 ++++---- Source/cmMakefileTargetGenerator.cxx | 13 +++++++------ Source/cmMakefileUtilityTargetGenerator.cxx | 7 ++++--- Source/cmNinjaNormalTargetGenerator.cxx | 5 +++-- Source/cmNinjaTargetGenerator.cxx | 4 ++-- Source/cmVisualStudio10TargetGenerator.cxx | 19 ++++++++++++------- 9 files changed, 35 insertions(+), 27 deletions(-) diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 2d74b9753..72b101f2b 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -274,7 +274,7 @@ void cmExportBuildFileGenerator tei = this->ExportSet->GetTargetExports()->begin(); tei != this->ExportSet->GetTargetExports()->end(); ++tei) { - targets.push_back((*tei)->Target->GetName()); + targets.push_back((*tei)->GetName()); } return; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c37f79793..d457e9c4b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1421,7 +1421,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target->Target->GetName().c_str()); + target->GetName().c_str()); return; } this->AddLanguageFlags(flags, linkLanguage, buildType); diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index ea910953d..433af7ea1 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -168,7 +168,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", - this->Target->GetName().c_str(), "\"."); + this->GeneratorTarget->GetName().c_str(), "\"."); return; } diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 669514300..6cde0f62a 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -122,11 +122,11 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - this->Target->GetName(), + this->GeneratorTarget->GetName(), depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName(), false); + this->WriteTargetDriverRule(this->GeneratorTarget->GetName(), false); } //---------------------------------------------------------------------------- @@ -244,7 +244,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", - this->Target->GetName().c_str(), "\"."); + this->GeneratorTarget->GetName().c_str(), "\"."); return; } @@ -574,7 +574,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string name_of_def_file = this->GeneratorTarget->GetSupportDirectory(); name_of_def_file += std::string("/") + - this->Target->GetName(); + this->GeneratorTarget->GetName(); name_of_def_file += ".def"; std::string cmd = cmSystemTools::GetCMakeCommand(); cmd = this->Convert(cmd, cmLocalGenerator::NONE, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 48a29b386..603214db6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -248,7 +248,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() // Write an empty dependency file. cmGeneratedFileStream depFileStream(dependFileNameFull.c_str()); depFileStream - << "# Empty dependencies file for " << this->Target->GetName() << ".\n" + << "# Empty dependencies file for " + << this->GeneratorTarget->GetName() << ".\n" << "# This may be replaced when dependencies are built." << std::endl; } @@ -394,7 +395,7 @@ void cmMakefileTargetGenerator err << "Warning: Source file \"" << source.GetFullPath() << "\" is listed multiple times for target \"" - << this->Target->GetName() + << this->GeneratorTarget->GetName() << "\"."; cmSystemTools::Message(err.str().c_str(), "Warning"); return; @@ -1267,10 +1268,10 @@ cmMakefileTargetGenerator // Write a make variable assignment that lists all objects for the // target. variableName = - this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), + this->LocalGenerator->CreateMakeVariable(this->GeneratorTarget->GetName(), "_OBJECTS"); *this->BuildFileStream - << "# Object files for target " << this->Target->GetName() << "\n" + << "# Object files for target " << this->GeneratorTarget->GetName() << "\n" << variableName << " ="; std::string object; const char* lineContinue = @@ -1292,12 +1293,12 @@ cmMakefileTargetGenerator // Write a make variable assignment that lists all external objects // for the target. variableNameExternal = - this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), + this->LocalGenerator->CreateMakeVariable(this->GeneratorTarget->GetName(), "_EXTERNAL_OBJECTS"); *this->BuildFileStream << "\n" << "# External object files for target " - << this->Target->GetName() << "\n" + << this->GeneratorTarget->GetName() << "\n" << variableNameExternal << " ="; for(std::vector::const_iterator i = this->ExternalObjects.begin(); diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 303ca639f..18594bb1e 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -42,7 +42,8 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() this->CreateRuleFile(); *this->BuildFileStream - << "# Utility rule file for " << this->Target->GetName() << ".\n\n"; + << "# Utility rule file for " + << this->GeneratorTarget->GetName() << ".\n\n"; if(!this->NoRuleMessages) { @@ -101,11 +102,11 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - this->Target->GetName(), + this->GeneratorTarget->GetName(), depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName(), false); + this->WriteTargetDriverRule(this->GeneratorTarget->GetName(), false); // Write clean target this->WriteTargetCleanRules(); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a8f182bce..e2061e5ed 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -77,7 +77,7 @@ void cmNinjaNormalTargetGenerator::Generate() if (this->TargetLinkLanguage.empty()) { cmSystemTools::Error("CMake can not determine linker language for " "target: ", - this->GetTarget()->GetName().c_str()); + this->GetGeneratorTarget()->GetName().c_str()); return; } @@ -158,7 +158,8 @@ cmNinjaNormalTargetGenerator + "_" + cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()) + "_LINKER__" - + cmGlobalNinjaGenerator::EncodeRuleName(this->GetTarget()->GetName()) + + cmGlobalNinjaGenerator::EncodeRuleName( + this->GetGeneratorTarget()->GetName()) ; } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 0eba0b367..3d1579f5d 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -92,7 +92,7 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule( const std::string& lang) const { return lang + "_COMPILER__" + - cmGlobalNinjaGenerator::EncodeRuleName(this->Target->GetName()); + cmGlobalNinjaGenerator::EncodeRuleName(this->GeneratorTarget->GetName()); } std::string @@ -271,7 +271,7 @@ cmNinjaTargetGenerator std::string cmNinjaTargetGenerator::GetTargetName() const { - return this->Target->GetName(); + return this->GeneratorTarget->GetName(); } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 79684124c..2225a46dd 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -178,7 +178,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->LocalGenerator = (cmLocalVisualStudio7Generator*) this->GeneratorTarget->GetLocalGenerator(); - this->Name = this->Target->GetName(); + this->Name = this->GeneratorTarget->GetName(); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->Platform = gg->GetPlatformName(); this->NsightTegra = gg->IsNsightTegra(); @@ -1775,7 +1775,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() if(ttype == cmState::OBJECT_LIBRARY) { outDir = intermediateDir; - targetNameFull = this->Target->GetName(); + targetNameFull = this->GeneratorTarget->GetName(); targetNameFull += ".lib"; } else @@ -3325,7 +3325,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80() this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->ConvertToWindowsSlash(artifactDir); std::string artifactDirXML = cmVS10EscapeXML(artifactDir); - std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); + std::string targetNameXML = + cmVS10EscapeXML(this->GeneratorTarget->GetName()); cmGeneratedFileStream fout(manifestFile.c_str()); fout.SetCopyIfDifferent(true); @@ -3408,7 +3409,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81() this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->ConvertToWindowsSlash(artifactDir); std::string artifactDirXML = cmVS10EscapeXML(artifactDir); - std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); + std::string targetNameXML = + cmVS10EscapeXML(this->GeneratorTarget->GetName()); cmGeneratedFileStream fout(manifestFile.c_str()); fout.SetCopyIfDifferent(true); @@ -3468,7 +3470,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80() this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->ConvertToWindowsSlash(artifactDir); std::string artifactDirXML = cmVS10EscapeXML(artifactDir); - std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); + std::string targetNameXML = + cmVS10EscapeXML(this->GeneratorTarget->GetName()); cmGeneratedFileStream fout(manifestFile.c_str()); fout.SetCopyIfDifferent(true); @@ -3520,7 +3523,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81() this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->ConvertToWindowsSlash(artifactDir); std::string artifactDirXML = cmVS10EscapeXML(artifactDir); - std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); + std::string targetNameXML = + cmVS10EscapeXML(this->GeneratorTarget->GetName()); cmGeneratedFileStream fout(manifestFile.c_str()); fout.SetCopyIfDifferent(true); @@ -3577,7 +3581,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0() this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->ConvertToWindowsSlash(artifactDir); std::string artifactDirXML = cmVS10EscapeXML(artifactDir); - std::string targetNameXML = cmVS10EscapeXML(this->Target->GetName()); + std::string targetNameXML = + cmVS10EscapeXML(this->GeneratorTarget->GetName()); cmGeneratedFileStream fout(manifestFile.c_str()); fout.SetCopyIfDifferent(true);