From a93038c52af110e1bf08968869c3ba868c582bd5 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 10 Dec 2002 15:55:43 -0500 Subject: [PATCH] ENH: update to new style MakeDepend --- Source/cmITKWrapTclCommand.cxx | 44 +++++++++++++++++++++++++--------- Source/cmITKWrapTclCommand.h | 7 ++++-- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/Source/cmITKWrapTclCommand.cxx b/Source/cmITKWrapTclCommand.cxx index 512f56706..e762ce598 100644 --- a/Source/cmITKWrapTclCommand.cxx +++ b/Source/cmITKWrapTclCommand.cxx @@ -27,6 +27,37 @@ cmITKWrapTclCommand::~cmITKWrapTclCommand() delete m_MakeDepend; } + + +void +cmITKWrapTclCommand::AddDependencies(cmDependInformation const *info, + std::vector& depends, + std::set& visited) +{ + if(!info) + { + return; + } + // add info to the visited set + visited.insert(info); + + // add this dependency and the recurse + // 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((*d)->m_FullPath != "") + { + depends.push_back((*d)->m_FullPath); + } + this->AddDependencies(*d,depends,visited); + } + } +} + // cmITKWrapTclCommand bool cmITKWrapTclCommand::InitialPass(std::vector const& argsIn) { @@ -154,17 +185,8 @@ bool cmITKWrapTclCommand::CreateCableRule(const char* configFile) m_MakeDepend->FindDependencies(inFile.c_str()); if (info) { - for(cmDependInformation::DependencySet::const_iterator d = - info->m_DependencySet.begin(); - d != info->m_DependencySet.end(); ++d) - { - // Make sure the full path is given. If not, the dependency was - // not found. - if((*d)->m_FullPath != "") - { - depends.push_back((*d)->m_FullPath); - } - } + std::set visited; + this->AddDependencies(info, depends, visited); } std::vector outputs; diff --git a/Source/cmITKWrapTclCommand.h b/Source/cmITKWrapTclCommand.h index 43af78795..c294acd53 100644 --- a/Source/cmITKWrapTclCommand.h +++ b/Source/cmITKWrapTclCommand.h @@ -19,7 +19,7 @@ #include "cmStandardIncludes.h" #include "cmCommand.h" - +class cmDependInformation; class cmMakeDepend; /** \class cmITKWrapTclCommand @@ -58,7 +58,10 @@ public: } cmTypeMacro(cmITKWrapTclCommand, cmCommand); -protected: +protected: + void AddDependencies(cmDependInformation const*info, + std::vector& depends, + std::set& visited); cmStdString m_TargetName; cmTarget* m_Target;