BUG: Remove duplicate targets when in different generators

This commit is contained in:
Andy Cedilnik 2005-06-01 09:25:10 -04:00
parent 35fcd2715e
commit cd97dc5f79
2 changed files with 19 additions and 14 deletions

View File

@ -144,6 +144,9 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile()
this->WriteAllRules(lg,makefileStream);
// Keep track of targets already listed.
std::set<cmStdString> emittedTargets;
// write the target convenience rules
unsigned int i;
for (i = 0; i < m_LocalGenerators.size(); ++i)
@ -161,7 +164,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile()
}
lg3 = lg3->GetParent();
}
this->WriteConvenienceRules(makefileStream,lg,exclude);
this->WriteConvenienceRules(makefileStream,lg,emittedTargets);
}
this->WriteHelpRule(makefileStream);
@ -687,11 +690,8 @@ void
cmGlobalUnixMakefileGenerator3
::WriteConvenienceRules(std::ostream& ruleFileStream,
cmLocalUnixMakefileGenerator3 *lg,
bool /* exclude */)
std::set<cmStdString> &emitted)
{
// Keep track of targets already listed.
std::set<cmStdString> emitted;
std::vector<std::string> depends;
std::vector<std::string> commands;
@ -936,13 +936,15 @@ cmGlobalUnixMakefileGenerator3::WriteHelpRule(std::ostream& ruleFileStream)
lg->AppendEcho(commands,"... install");
lg->AppendEcho(commands,"... rebuild_cache");
// Keep track of targets already listed.
std::set<cmStdString> emittedTargets;
// for each local generator
unsigned int i;
for (i = 0; i < m_LocalGenerators.size(); ++i)
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]);
// for each target Generate the rule files for each target.
const cmTargets& targets = lg->GetMakefile()->GetTargets();
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
@ -952,6 +954,8 @@ cmGlobalUnixMakefileGenerator3::WriteHelpRule(std::ostream& ruleFileStream)
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
(t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
(t->second.GetType() == cmTarget::UTILITY))
{
if(emittedTargets.insert(t->second.GetName()).second)
{
path = "... ";
path += t->second.GetName();
@ -959,6 +963,7 @@ cmGlobalUnixMakefileGenerator3::WriteHelpRule(std::ostream& ruleFileStream)
}
}
}
}
lg->WriteMakeRule(ruleFileStream, "Help Target",
"help:",
no_depends, commands);

View File

@ -95,7 +95,7 @@ protected:
void WriteConvenienceRules(std::ostream& ruleFileStream,
cmLocalUnixMakefileGenerator3 *,
bool exclude);
std::set<cmStdString> &emitted);
void WriteConvenienceRules2(std::ostream& ruleFileStream,
cmLocalUnixMakefileGenerator3 *,
bool exclude);