summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-10-10 19:32:37 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-11-22 14:06:25 (GMT)
commitc34968a9aa12221f54973a56d4e98940cff676a5 (patch)
tree706aef3eddc310e5836120498fdf054a2334b8d4 /Source/cmGlobalUnixMakefileGenerator3.cxx
parentabb13ea5659cdaa4254724fca582f56570f88164 (diff)
downloadCMake-c34968a9aa12221f54973a56d4e98940cff676a5.zip
CMake-c34968a9aa12221f54973a56d4e98940cff676a5.tar.gz
CMake-c34968a9aa12221f54973a56d4e98940cff676a5.tar.bz2
Port some of the generator API to cmGeneratorTarget.
Just enough to reach the BuildMacContentDirectory method and the NeedRelinkBeforeInstall methods. In the future, those methods can be moved to cmGeneratorTarget.
Diffstat (limited to 'Source/cmGlobalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx135
1 files changed, 77 insertions, 58 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index e1af2f9..6333873 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -471,23 +471,29 @@ cmGlobalUnixMakefileGenerator3
// The directory-level rule should depend on the target-level rules
// for all targets in the directory.
std::vector<std::string> depends;
- for(cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin();
- l != lg->GetMakefile()->GetTargets().end(); ++l)
+ cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
+ for(cmGeneratorTargetsType::iterator l = targets.begin();
+ l != targets.end(); ++l)
{
- if((l->second.GetType() == cmTarget::EXECUTABLE) ||
- (l->second.GetType() == cmTarget::STATIC_LIBRARY) ||
- (l->second.GetType() == cmTarget::SHARED_LIBRARY) ||
- (l->second.GetType() == cmTarget::MODULE_LIBRARY) ||
- (l->second.GetType() == cmTarget::OBJECT_LIBRARY) ||
- (l->second.GetType() == cmTarget::INTERFACE_LIBRARY) ||
- (l->second.GetType() == cmTarget::UTILITY))
+ if((l->second->GetType() == cmTarget::EXECUTABLE) ||
+ (l->second->GetType() == cmTarget::STATIC_LIBRARY) ||
+ (l->second->GetType() == cmTarget::SHARED_LIBRARY) ||
+ (l->second->GetType() == cmTarget::MODULE_LIBRARY) ||
+ (l->second->GetType() == cmTarget::OBJECT_LIBRARY) ||
+ (l->second->GetType() == cmTarget::INTERFACE_LIBRARY) ||
+ (l->second->GetType() == cmTarget::UTILITY))
{
+ if(l->second->Target->IsImported())
+ {
+ continue;
+ }
// Add this to the list of depends rules in this directory.
- if((!check_all || !l->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
+ if((!check_all || !l->second->GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
(!check_relink ||
- l->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())))
+ l->second->Target
+ ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())))
{
- std::string tname = lg->GetRelativeTargetDirectory(l->second);
+ std::string tname = lg->GetRelativeTargetDirectory(*l->second->Target);
tname += "/";
tname += pass;
depends.push_back(tname);
@@ -632,49 +638,55 @@ cmGlobalUnixMakefileGenerator3
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->LocalGenerators[i]);
// for each target Generate the rule files for each target.
- cmTargets& targets = lg->GetMakefile()->GetTargets();
- for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
+ cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
+ for(cmGeneratorTargetsType::iterator t = targets.begin();
+ t != targets.end(); ++t)
{
+ if(t->second->Target->IsImported())
+ {
+ continue;
+ }
// Don't emit the same rule twice (e.g. two targets with the same
// simple name)
- if(t->second.GetName() &&
- strlen(t->second.GetName()) &&
- emitted.insert(t->second.GetName()).second &&
+ if(t->second->GetName() &&
+ strlen(t->second->GetName()) &&
+ emitted.insert(t->second->GetName()).second &&
// Handle user targets here. Global targets are handled in
// the local generator on a per-directory basis.
- ((t->second.GetType() == cmTarget::EXECUTABLE) ||
- (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
- (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
- (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
- (t->second.GetType() == cmTarget::OBJECT_LIBRARY) ||
- (t->second.GetType() == cmTarget::INTERFACE_LIBRARY) ||
- (t->second.GetType() == cmTarget::UTILITY)))
+ ((t->second->GetType() == cmTarget::EXECUTABLE) ||
+ (t->second->GetType() == cmTarget::STATIC_LIBRARY) ||
+ (t->second->GetType() == cmTarget::SHARED_LIBRARY) ||
+ (t->second->GetType() == cmTarget::MODULE_LIBRARY) ||
+ (t->second->GetType() == cmTarget::OBJECT_LIBRARY) ||
+ (t->second->GetType() == cmTarget::INTERFACE_LIBRARY) ||
+ (t->second->GetType() == cmTarget::UTILITY)))
{
// Add a rule to build the target by name.
lg->WriteDivider(ruleFileStream);
ruleFileStream
<< "# Target rules for targets named "
- << t->second.GetName() << "\n\n";
+ << t->second->GetName() << "\n\n";
// Write the rule.
commands.clear();
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
tmp += "Makefile2";
commands.push_back(lg->GetRecursiveMakeCall
- (tmp.c_str(),t->second.GetName()));
+ (tmp.c_str(),t->second->GetName()));
depends.clear();
depends.push_back("cmake_check_build_system");
lg->WriteMakeRule(ruleFileStream,
"Build rule for target.",
- t->second.GetName(), depends, commands,
+ t->second->GetName(), depends, commands,
true);
- if (t->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+ if (t->second->GetType() == cmTarget::INTERFACE_LIBRARY)
{
continue;
}
// Add a fast rule to build the target
- std::string localName = lg->GetRelativeTargetDirectory(t->second);
+ std::string localName =
+ lg->GetRelativeTargetDirectory(*t->second->Target);
std::string makefileName;
makefileName = localName;
makefileName += "/build.make";
@@ -682,7 +694,7 @@ cmGlobalUnixMakefileGenerator3
commands.clear();
std::string makeTargetName = localName;
makeTargetName += "/build";
- localName = t->second.GetName();
+ localName = t->second->GetName();
localName += "/fast";
commands.push_back(lg->GetRecursiveMakeCall
(makefileName.c_str(), makeTargetName.c_str()));
@@ -691,11 +703,12 @@ cmGlobalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before
// installation.
- if(t->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
+ if(t->second->Target
+ ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{
- makeTargetName = lg->GetRelativeTargetDirectory(t->second);
+ makeTargetName = lg->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName += "/preinstall";
- localName = t->second.GetName();
+ localName = t->second->GetName();
localName += "/preinstall";
depends.clear();
commands.clear();
@@ -729,26 +742,31 @@ cmGlobalUnixMakefileGenerator3
depends.push_back("cmake_check_build_system");
// for each target Generate the rule files for each target.
- cmTargets& targets = lg->GetMakefile()->GetTargets();
- for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
+ cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
+ for(cmGeneratorTargetsType::iterator t = targets.begin();
+ t != targets.end(); ++t)
{
- if (t->second.GetName()
- && strlen(t->second.GetName())
- && ((t->second.GetType() == cmTarget::EXECUTABLE)
- || (t->second.GetType() == cmTarget::STATIC_LIBRARY)
- || (t->second.GetType() == cmTarget::SHARED_LIBRARY)
- || (t->second.GetType() == cmTarget::MODULE_LIBRARY)
- || (t->second.GetType() == cmTarget::OBJECT_LIBRARY)
- || (t->second.GetType() == cmTarget::INTERFACE_LIBRARY)
- || (t->second.GetType() == cmTarget::UTILITY)))
+ if(t->second->Target->IsImported())
+ {
+ continue;
+ }
+ if (t->second->GetName()
+ && strlen(t->second->GetName())
+ && ((t->second->GetType() == cmTarget::EXECUTABLE)
+ || (t->second->GetType() == cmTarget::STATIC_LIBRARY)
+ || (t->second->GetType() == cmTarget::SHARED_LIBRARY)
+ || (t->second->GetType() == cmTarget::MODULE_LIBRARY)
+ || (t->second->GetType() == cmTarget::OBJECT_LIBRARY)
+ || (t->second->GetType() == cmTarget::INTERFACE_LIBRARY)
+ || (t->second->GetType() == cmTarget::UTILITY)))
{
std::string makefileName;
// Add a rule to build the target by name.
- localName = lg->GetRelativeTargetDirectory(t->second);
+ localName = lg->GetRelativeTargetDirectory(*t->second->Target);
makefileName = localName;
makefileName += "/build.make";
- bool needRequiresStep = this->NeedRequiresStep(t->second);
+ bool needRequiresStep = this->NeedRequiresStep(*t->second->Target);
lg->WriteDivider(ruleFileStream);
ruleFileStream
@@ -757,7 +775,7 @@ cmGlobalUnixMakefileGenerator3
commands.clear();
- if(t->second.GetType() != cmTarget::INTERFACE_LIBRARY)
+ if(t->second->GetType() != cmTarget::INTERFACE_LIBRARY)
{
makeTargetName = localName;
makeTargetName += "/depend";
@@ -793,7 +811,7 @@ cmGlobalUnixMakefileGenerator3
cmLocalGenerator::SHELL);
progCmd << " ";
std::vector<unsigned long>& progFiles =
- this->ProgressMap[&t->second].Marks;
+ this->ProgressMap[t->second->Target].Marks;
for (std::vector<unsigned long>::iterator i = progFiles.begin();
i != progFiles.end(); ++i)
{
@@ -802,14 +820,14 @@ cmGlobalUnixMakefileGenerator3
commands.push_back(progCmd.str());
}
progressDir = "Built target ";
- progressDir += t->first;
+ progressDir += t->second->GetName();
lg->AppendEcho(commands,progressDir.c_str());
}
else
{
depends.clear();
}
- this->AppendGlobalTargetDepends(depends,t->second);
+ this->AppendGlobalTargetDepends(depends,*t->second->Target);
if(depends.empty() && this->EmptyRuleHackDepends != "")
{
depends.push_back(this->EmptyRuleHackDepends);
@@ -818,7 +836,7 @@ cmGlobalUnixMakefileGenerator3
localName.c_str(), depends, commands, true);
// add the all/all dependency
- if(!this->IsExcluded(this->LocalGenerators[0], t->second))
+ if(!this->IsExcluded(this->LocalGenerators[0], *t->second->Target))
{
depends.clear();
depends.push_back(localName);
@@ -843,7 +861,7 @@ cmGlobalUnixMakefileGenerator3
//
std::set<cmTarget *> emitted;
progCmd << " "
- << this->CountProgressMarksInTarget(&t->second, emitted);
+ << this->CountProgressMarksInTarget(t->second->Target, emitted);
commands.push_back(progCmd.str());
}
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
@@ -861,7 +879,7 @@ cmGlobalUnixMakefileGenerator3
}
depends.clear();
depends.push_back("cmake_check_build_system");
- localName = lg->GetRelativeTargetDirectory(t->second);
+ localName = lg->GetRelativeTargetDirectory(*t->second->Target);
localName += "/rule";
lg->WriteMakeRule(ruleFileStream,
"Build rule for subdir invocation for target.",
@@ -872,12 +890,13 @@ cmGlobalUnixMakefileGenerator3
depends.clear();
depends.push_back(localName);
lg->WriteMakeRule(ruleFileStream, "Convenience name for target.",
- t->second.GetName(), depends, commands, true);
+ t->second->GetName(), depends, commands, true);
// Add rules to prepare the target for installation.
- if(t->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
+ if(t->second->Target
+ ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{
- localName = lg->GetRelativeTargetDirectory(t->second);
+ localName = lg->GetRelativeTargetDirectory(*t->second->Target);
localName += "/preinstall";
depends.clear();
commands.clear();
@@ -887,7 +906,7 @@ cmGlobalUnixMakefileGenerator3
"Pre-install relink rule for target.",
localName.c_str(), depends, commands, true);
- if(!this->IsExcluded(this->LocalGenerators[0], t->second))
+ if(!this->IsExcluded(this->LocalGenerators[0], *t->second->Target))
{
depends.clear();
depends.push_back(localName);
@@ -898,7 +917,7 @@ cmGlobalUnixMakefileGenerator3
}
// add the clean rule
- localName = lg->GetRelativeTargetDirectory(t->second);
+ localName = lg->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName = localName;
makeTargetName += "/clean";
depends.clear();