cmLocalUnixMakefileGenerator3: Port another API to cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-10-15 00:12:53 +02:00
parent 9f299a1225
commit c8f8f16541
4 changed files with 24 additions and 22 deletions

View File

@ -435,7 +435,8 @@ void cmGlobalUnixMakefileGenerator3
(l->second.GetType() == cmTarget::OBJECT_LIBRARY) || (l->second.GetType() == cmTarget::OBJECT_LIBRARY) ||
(l->second.GetType() == cmTarget::UTILITY)) (l->second.GetType() == cmTarget::UTILITY))
{ {
std::string tname = lg->GetRelativeTargetDirectory(l->second); cmGeneratorTarget* gt = this->GetGeneratorTarget(&l->second);
std::string tname = lg->GetRelativeTargetDirectory(gt);
tname += "/DependInfo.cmake"; tname += "/DependInfo.cmake";
cmSystemTools::ConvertToUnixSlashes(tname); cmSystemTools::ConvertToUnixSlashes(tname);
cmakefileStream << " \"" << tname << "\"\n"; cmakefileStream << " \"" << tname << "\"\n";
@ -484,7 +485,7 @@ cmGlobalUnixMakefileGenerator3
gtarget gtarget
->NeedRelinkBeforeInstall(lg->GetConfigName()))) ->NeedRelinkBeforeInstall(lg->GetConfigName())))
{ {
std::string tname = lg->GetRelativeTargetDirectory(*gtarget->Target); std::string tname = lg->GetRelativeTargetDirectory(gtarget);
tname += "/"; tname += "/";
tname += pass; tname += pass;
depends.push_back(tname); depends.push_back(tname);
@ -673,7 +674,7 @@ cmGlobalUnixMakefileGenerator3
// Add a fast rule to build the target // Add a fast rule to build the target
std::string localName = std::string localName =
lg->GetRelativeTargetDirectory(*gtarget->Target); lg->GetRelativeTargetDirectory(gtarget);
std::string makefileName; std::string makefileName;
makefileName = localName; makefileName = localName;
makefileName += "/build.make"; makefileName += "/build.make";
@ -693,7 +694,7 @@ cmGlobalUnixMakefileGenerator3
if(gtarget if(gtarget
->NeedRelinkBeforeInstall(lg->GetConfigName())) ->NeedRelinkBeforeInstall(lg->GetConfigName()))
{ {
makeTargetName = lg->GetRelativeTargetDirectory(*gtarget->Target); makeTargetName = lg->GetRelativeTargetDirectory(gtarget);
makeTargetName += "/preinstall"; makeTargetName += "/preinstall";
localName = name; localName = name;
localName += "/preinstall"; localName += "/preinstall";
@ -750,7 +751,7 @@ cmGlobalUnixMakefileGenerator3
{ {
std::string makefileName; std::string makefileName;
// Add a rule to build the target by name. // Add a rule to build the target by name.
localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName = lg->GetRelativeTargetDirectory(gtarget);
makefileName = localName; makefileName = localName;
makefileName += "/build.make"; makefileName += "/build.make";
@ -861,7 +862,7 @@ cmGlobalUnixMakefileGenerator3
} }
depends.clear(); depends.clear();
depends.push_back("cmake_check_build_system"); depends.push_back("cmake_check_build_system");
localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName = lg->GetRelativeTargetDirectory(gtarget);
localName += "/rule"; localName += "/rule";
lg->WriteMakeRule(ruleFileStream, lg->WriteMakeRule(ruleFileStream,
"Build rule for subdir invocation for target.", "Build rule for subdir invocation for target.",
@ -878,7 +879,7 @@ cmGlobalUnixMakefileGenerator3
if(gtarget if(gtarget
->NeedRelinkBeforeInstall(lg->GetConfigName())) ->NeedRelinkBeforeInstall(lg->GetConfigName()))
{ {
localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName = lg->GetRelativeTargetDirectory(gtarget);
localName += "/preinstall"; localName += "/preinstall";
depends.clear(); depends.clear();
commands.clear(); commands.clear();
@ -899,7 +900,7 @@ cmGlobalUnixMakefileGenerator3
} }
// add the clean rule // add the clean rule
localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName = lg->GetRelativeTargetDirectory(gtarget);
makeTargetName = localName; makeTargetName = localName;
makeTargetName += "/clean"; makeTargetName += "/clean";
depends.clear(); depends.clear();
@ -1066,7 +1067,8 @@ cmGlobalUnixMakefileGenerator3
} }
cmLocalUnixMakefileGenerator3* lg3 = cmLocalUnixMakefileGenerator3* lg3 =
static_cast<cmLocalUnixMakefileGenerator3*>(dep->GetLocalGenerator()); static_cast<cmLocalUnixMakefileGenerator3*>(dep->GetLocalGenerator());
std::string tgtName = lg3->GetRelativeTargetDirectory(*(*dep).Target); std::string tgtName =
lg3->GetRelativeTargetDirectory(const_cast<cmGeneratorTarget*>(dep));
tgtName += "/all"; tgtName += "/all";
depends.push_back(tgtName); depends.push_back(tgtName);
} }

View File

@ -389,7 +389,7 @@ cmLocalUnixMakefileGenerator3
t != info.end(); ++t) t != info.end(); ++t)
{ {
std::string tgtMakefileName = std::string tgtMakefileName =
this->GetRelativeTargetDirectory(*(t->Target->Target)); this->GetRelativeTargetDirectory(t->Target);
std::string targetName = tgtMakefileName; std::string targetName = tgtMakefileName;
tgtMakefileName += "/build.make"; tgtMakefileName += "/build.make";
targetName += "/"; targetName += "/";
@ -438,7 +438,7 @@ void cmLocalUnixMakefileGenerator3
emitted.insert(t->second->GetName()); emitted.insert(t->second->GetName());
// for subdirs add a rule to build this specific target by name. // for subdirs add a rule to build this specific target by name.
localName = this->GetRelativeTargetDirectory(*t->second->Target); localName = this->GetRelativeTargetDirectory(t->second);
localName += "/rule"; localName += "/rule";
commands.clear(); commands.clear();
depends.clear(); depends.clear();
@ -465,11 +465,11 @@ void cmLocalUnixMakefileGenerator3
// Add a fast rule to build the target // Add a fast rule to build the target
std::string makefileName = std::string makefileName =
this->GetRelativeTargetDirectory(*t->second->Target); this->GetRelativeTargetDirectory(t->second);
makefileName += "/build.make"; makefileName += "/build.make";
// make sure the makefile name is suitable for a makefile // make sure the makefile name is suitable for a makefile
std::string makeTargetName = std::string makeTargetName =
this->GetRelativeTargetDirectory(*t->second->Target); this->GetRelativeTargetDirectory(t->second);
makeTargetName += "/build"; makeTargetName += "/build";
localName = t->second->GetName(); localName = t->second->GetName();
localName += "/fast"; localName += "/fast";
@ -487,7 +487,7 @@ void cmLocalUnixMakefileGenerator3
// installation. // installation.
if(t->second->NeedRelinkBeforeInstall(this->ConfigName)) if(t->second->NeedRelinkBeforeInstall(this->ConfigName))
{ {
makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target); makeTargetName = this->GetRelativeTargetDirectory(t->second);
makeTargetName += "/preinstall"; makeTargetName += "/preinstall";
localName = t->second->GetName(); localName = t->second->GetName();
localName += "/preinstall"; localName += "/preinstall";
@ -933,10 +933,10 @@ cmLocalUnixMakefileGenerator3
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmLocalUnixMakefileGenerator3 cmLocalUnixMakefileGenerator3
::GetRelativeTargetDirectory(cmTarget const& target) ::GetRelativeTargetDirectory(cmGeneratorTarget* target)
{ {
std::string dir = this->HomeRelativeOutputPath; std::string dir = this->HomeRelativeOutputPath;
dir += this->GetTargetDirectory(target); dir += this->GetTargetDirectory(*target->Target);
return this->Convert(dir,NONE,UNCHANGED); return this->Convert(dir,NONE,UNCHANGED);
} }

View File

@ -131,7 +131,7 @@ public:
void WriteSpecialTargetsTop(std::ostream& makefileStream); void WriteSpecialTargetsTop(std::ostream& makefileStream);
void WriteSpecialTargetsBottom(std::ostream& makefileStream); void WriteSpecialTargetsBottom(std::ostream& makefileStream);
std::string GetRelativeTargetDirectory(cmTarget const& target); std::string GetRelativeTargetDirectory(cmGeneratorTarget* target);
// File pairs for implicit dependency scanning. The key of the map // File pairs for implicit dependency scanning. The key of the map
// is the depender and the value is the explicit dependee. // is the depender and the value is the explicit dependee.

View File

@ -870,7 +870,7 @@ cmMakefileTargetGenerator
temp += ".provides.build"; temp += ".provides.build";
std::vector<std::string> r_commands; std::vector<std::string> r_commands;
std::string tgtMakefileName = std::string tgtMakefileName =
this->LocalGenerator->GetRelativeTargetDirectory(*this->Target); this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
tgtMakefileName += "/build.make"; tgtMakefileName += "/build.make";
r_commands.push_back r_commands.push_back
(this->LocalGenerator->GetRecursiveMakeCall(tgtMakefileName.c_str(), (this->LocalGenerator->GetRecursiveMakeCall(tgtMakefileName.c_str(),
@ -898,7 +898,7 @@ void cmMakefileTargetGenerator::WriteTargetRequiresRules()
// Construct the name of the dependency generation target. // Construct the name of the dependency generation target.
std::string depTarget = std::string depTarget =
this->LocalGenerator->GetRelativeTargetDirectory(*this->Target); this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
depTarget += "/requires"; depTarget += "/requires";
// This target drives dependency generation for all object files. // This target drives dependency generation for all object files.
@ -927,7 +927,7 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
// Construct the clean target name. // Construct the clean target name.
std::string cleanTarget = std::string cleanTarget =
this->LocalGenerator->GetRelativeTargetDirectory(*this->Target); this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
cleanTarget += "/clean"; cleanTarget += "/clean";
// Construct the clean command. // Construct the clean command.
@ -1086,7 +1086,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// Construct the name of the dependency generation target. // Construct the name of the dependency generation target.
std::string depTarget = std::string depTarget =
this->LocalGenerator->GetRelativeTargetDirectory(*this->Target); this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
depTarget += "/depend"; depTarget += "/depend";
// Add a command to call CMake to scan dependencies. CMake will // Add a command to call CMake to scan dependencies. CMake will
@ -1400,7 +1400,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
{ {
// Compute the name of the driver target. // Compute the name of the driver target.
std::string dir = std::string dir =
this->LocalGenerator->GetRelativeTargetDirectory(*this->Target); this->LocalGenerator->GetRelativeTargetDirectory(this->GeneratorTarget);
std::string buildTargetRuleName = dir; std::string buildTargetRuleName = dir;
buildTargetRuleName += relink?"/preinstall":"/build"; buildTargetRuleName += relink?"/preinstall":"/build";
buildTargetRuleName = this->Convert(buildTargetRuleName, buildTargetRuleName = this->Convert(buildTargetRuleName,