updated for changes in Depend Calcs

This commit is contained in:
Ken Martin 2002-12-10 14:10:15 -05:00
parent 65032b816e
commit 7928df0817
2 changed files with 36 additions and 12 deletions

View File

@ -172,6 +172,36 @@ bool cmOutputRequiredFilesCommand::InitialPass(std::vector<std::string> const& a
return true; return true;
} }
void cmOutputRequiredFilesCommand::
ListDependencies(cmDependInformation const *info,
FILE *fout,
std::set<cmDependInformation const*> *visited)
{
// add info to the visited set
visited->insert(info);
// now recurse with info's dependencies
for(cmDependInformation::DependencySet::const_iterator d =
info->m_DependencySet.begin();
d != info->m_DependencySet.end(); ++d)
{
if (visited->find(*d) == visited->end())
{
if(info->m_FullPath != "")
{
std::string tmp = (*d)->m_FullPath;
std::string::size_type pos = tmp.rfind('.');
if(pos != std::string::npos && tmp.substr(pos) == ".cxx")
{
tmp = tmp.substr(0, pos);
fprintf(fout,"%s\n",(*d)->m_FullPath.c_str());
}
}
this->ListDependencies(*d,fout,visited);
}
}
}
void cmOutputRequiredFilesCommand::FinalPass() void cmOutputRequiredFilesCommand::FinalPass()
{ {
@ -191,18 +221,8 @@ void cmOutputRequiredFilesCommand::FinalPass()
{ {
// write them out // write them out
FILE *fout = fopen(m_OutputFile.c_str(),"w"); FILE *fout = fopen(m_OutputFile.c_str(),"w");
for(cmDependInformation::DependencySet::const_iterator d = std::set<cmDependInformation const*> visited;
info->m_DependencySet.begin(); this->ListDependencies(info,fout, &visited);
d != info->m_DependencySet.end(); ++d)
{
std::string tmp = (*d)->m_FullPath;
std::string::size_type pos = tmp.rfind('.');
if(pos != std::string::npos && tmp.substr(pos) == ".cxx")
{
tmp = tmp.substr(0, pos);
fprintf(fout,"%s\n",(*d)->m_FullPath.c_str());
}
}
fclose(fout); fclose(fout);
} }
} }

View File

@ -68,6 +68,10 @@ public:
} }
cmTypeMacro(cmOutputRequiredFilesCommand, cmCommand); cmTypeMacro(cmOutputRequiredFilesCommand, cmCommand);
void ListDependencies(cmDependInformation const *info,
FILE *fout,
std::set<cmDependInformation const*> *visited);
private: private:
std::string m_File; std::string m_File;
std::string m_OutputFile; std::string m_OutputFile;