Use GetName from cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-10-16 20:09:43 +02:00
parent ed09f3b292
commit b857f0d84b
9 changed files with 35 additions and 27 deletions

View File

@ -274,7 +274,7 @@ void cmExportBuildFileGenerator
tei = this->ExportSet->GetTargetExports()->begin(); tei = this->ExportSet->GetTargetExports()->begin();
tei != this->ExportSet->GetTargetExports()->end(); ++tei) tei != this->ExportSet->GetTargetExports()->end(); ++tei)
{ {
targets.push_back((*tei)->Target->GetName()); targets.push_back((*tei)->GetName());
} }
return; return;
} }

View File

@ -1421,7 +1421,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{ {
cmSystemTools::Error cmSystemTools::Error
("CMake can not determine linker language for target: ", ("CMake can not determine linker language for target: ",
target->Target->GetName().c_str()); target->GetName().c_str());
return; return;
} }
this->AddLanguageFlags(flags, linkLanguage, buildType); this->AddLanguageFlags(flags, linkLanguage, buildType);

View File

@ -168,7 +168,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
if(linkLanguage.empty()) if(linkLanguage.empty())
{ {
cmSystemTools::Error("Cannot determine link language for target \"", cmSystemTools::Error("Cannot determine link language for target \"",
this->Target->GetName().c_str(), "\"."); this->GeneratorTarget->GetName().c_str(), "\".");
return; return;
} }

View File

@ -122,11 +122,11 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
// Write the rule. // Write the rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
this->Target->GetName(), this->GeneratorTarget->GetName(),
depends, commands, true); depends, commands, true);
// Write the main driver rule to build everything in this target. // 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()) if(linkLanguage.empty())
{ {
cmSystemTools::Error("Cannot determine link language for target \"", cmSystemTools::Error("Cannot determine link language for target \"",
this->Target->GetName().c_str(), "\"."); this->GeneratorTarget->GetName().c_str(), "\".");
return; return;
} }
@ -574,7 +574,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string name_of_def_file = std::string name_of_def_file =
this->GeneratorTarget->GetSupportDirectory(); this->GeneratorTarget->GetSupportDirectory();
name_of_def_file += std::string("/") + name_of_def_file += std::string("/") +
this->Target->GetName(); this->GeneratorTarget->GetName();
name_of_def_file += ".def"; name_of_def_file += ".def";
std::string cmd = cmSystemTools::GetCMakeCommand(); std::string cmd = cmSystemTools::GetCMakeCommand();
cmd = this->Convert(cmd, cmLocalGenerator::NONE, cmd = this->Convert(cmd, cmLocalGenerator::NONE,

View File

@ -248,7 +248,8 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
// Write an empty dependency file. // Write an empty dependency file.
cmGeneratedFileStream depFileStream(dependFileNameFull.c_str()); cmGeneratedFileStream depFileStream(dependFileNameFull.c_str());
depFileStream 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; << "# This may be replaced when dependencies are built." << std::endl;
} }
@ -394,7 +395,7 @@ void cmMakefileTargetGenerator
err << "Warning: Source file \"" err << "Warning: Source file \""
<< source.GetFullPath() << source.GetFullPath()
<< "\" is listed multiple times for target \"" << "\" is listed multiple times for target \""
<< this->Target->GetName() << this->GeneratorTarget->GetName()
<< "\"."; << "\".";
cmSystemTools::Message(err.str().c_str(), "Warning"); cmSystemTools::Message(err.str().c_str(), "Warning");
return; return;
@ -1267,10 +1268,10 @@ cmMakefileTargetGenerator
// Write a make variable assignment that lists all objects for the // Write a make variable assignment that lists all objects for the
// target. // target.
variableName = variableName =
this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), this->LocalGenerator->CreateMakeVariable(this->GeneratorTarget->GetName(),
"_OBJECTS"); "_OBJECTS");
*this->BuildFileStream *this->BuildFileStream
<< "# Object files for target " << this->Target->GetName() << "\n" << "# Object files for target " << this->GeneratorTarget->GetName() << "\n"
<< variableName << " ="; << variableName << " =";
std::string object; std::string object;
const char* lineContinue = const char* lineContinue =
@ -1292,12 +1293,12 @@ cmMakefileTargetGenerator
// Write a make variable assignment that lists all external objects // Write a make variable assignment that lists all external objects
// for the target. // for the target.
variableNameExternal = variableNameExternal =
this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), this->LocalGenerator->CreateMakeVariable(this->GeneratorTarget->GetName(),
"_EXTERNAL_OBJECTS"); "_EXTERNAL_OBJECTS");
*this->BuildFileStream *this->BuildFileStream
<< "\n" << "\n"
<< "# External object files for target " << "# External object files for target "
<< this->Target->GetName() << "\n" << this->GeneratorTarget->GetName() << "\n"
<< variableNameExternal << " ="; << variableNameExternal << " =";
for(std::vector<std::string>::const_iterator i = for(std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin(); this->ExternalObjects.begin();

View File

@ -42,7 +42,8 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
this->CreateRuleFile(); this->CreateRuleFile();
*this->BuildFileStream *this->BuildFileStream
<< "# Utility rule file for " << this->Target->GetName() << ".\n\n"; << "# Utility rule file for "
<< this->GeneratorTarget->GetName() << ".\n\n";
if(!this->NoRuleMessages) if(!this->NoRuleMessages)
{ {
@ -101,11 +102,11 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
// Write the rule. // Write the rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
this->Target->GetName(), this->GeneratorTarget->GetName(),
depends, commands, true); depends, commands, true);
// Write the main driver rule to build everything in this target. // 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 // Write clean target
this->WriteTargetCleanRules(); this->WriteTargetCleanRules();

View File

@ -77,7 +77,7 @@ void cmNinjaNormalTargetGenerator::Generate()
if (this->TargetLinkLanguage.empty()) { if (this->TargetLinkLanguage.empty()) {
cmSystemTools::Error("CMake can not determine linker language for " cmSystemTools::Error("CMake can not determine linker language for "
"target: ", "target: ",
this->GetTarget()->GetName().c_str()); this->GetGeneratorTarget()->GetName().c_str());
return; return;
} }
@ -158,7 +158,8 @@ cmNinjaNormalTargetGenerator
+ "_" + "_"
+ cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()) + cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType())
+ "_LINKER__" + "_LINKER__"
+ cmGlobalNinjaGenerator::EncodeRuleName(this->GetTarget()->GetName()) + cmGlobalNinjaGenerator::EncodeRuleName(
this->GetGeneratorTarget()->GetName())
; ;
} }

View File

@ -92,7 +92,7 @@ std::string cmNinjaTargetGenerator::LanguageCompilerRule(
const std::string& lang) const const std::string& lang) const
{ {
return lang + "_COMPILER__" + return lang + "_COMPILER__" +
cmGlobalNinjaGenerator::EncodeRuleName(this->Target->GetName()); cmGlobalNinjaGenerator::EncodeRuleName(this->GeneratorTarget->GetName());
} }
std::string std::string
@ -271,7 +271,7 @@ cmNinjaTargetGenerator
std::string cmNinjaTargetGenerator::GetTargetName() const std::string cmNinjaTargetGenerator::GetTargetName() const
{ {
return this->Target->GetName(); return this->GeneratorTarget->GetName();
} }

View File

@ -178,7 +178,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
this->LocalGenerator = this->LocalGenerator =
(cmLocalVisualStudio7Generator*) (cmLocalVisualStudio7Generator*)
this->GeneratorTarget->GetLocalGenerator(); this->GeneratorTarget->GetLocalGenerator();
this->Name = this->Target->GetName(); this->Name = this->GeneratorTarget->GetName();
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
this->Platform = gg->GetPlatformName(); this->Platform = gg->GetPlatformName();
this->NsightTegra = gg->IsNsightTegra(); this->NsightTegra = gg->IsNsightTegra();
@ -1775,7 +1775,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
if(ttype == cmState::OBJECT_LIBRARY) if(ttype == cmState::OBJECT_LIBRARY)
{ {
outDir = intermediateDir; outDir = intermediateDir;
targetNameFull = this->Target->GetName(); targetNameFull = this->GeneratorTarget->GetName();
targetNameFull += ".lib"; targetNameFull += ".lib";
} }
else else
@ -3325,7 +3325,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->ConvertToWindowsSlash(artifactDir); this->ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(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()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
@ -3408,7 +3409,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->ConvertToWindowsSlash(artifactDir); this->ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(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()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
@ -3468,7 +3470,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->ConvertToWindowsSlash(artifactDir); this->ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(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()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
@ -3520,7 +3523,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->ConvertToWindowsSlash(artifactDir); this->ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(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()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
@ -3577,7 +3581,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0()
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
this->ConvertToWindowsSlash(artifactDir); this->ConvertToWindowsSlash(artifactDir);
std::string artifactDirXML = cmVS10EscapeXML(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()); cmGeneratedFileStream fout(manifestFile.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);