소스 검색

cmComputeLinkDepends: Convert AddLinkEntries to a template

Allow the method to be called with a vector of any type that can be
converted to cmLinkItem.
Brad King 11 년 전
부모
커밋
82e91e3487
2개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 3 2
      Source/cmComputeLinkDepends.cxx
  2. 2 2
      Source/cmComputeLinkDepends.h

+ 3 - 2
Source/cmComputeLinkDepends.cxx

@@ -553,15 +553,16 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
 }
 
 //----------------------------------------------------------------------------
+template <typename T>
 void
 cmComputeLinkDepends::AddLinkEntries(
-  int depender_index, std::vector<cmLinkItem> const& libs)
+  int depender_index, std::vector<T> const& libs)
 {
   // Track inferred dependency sets implied by this list.
   std::map<int, DependSet> dependSets;
 
   // Loop over the libraries linked directly by the depender.
-  for(std::vector<cmLinkItem>::const_iterator li = libs.begin();
+  for(typename std::vector<T>::const_iterator li = libs.begin();
       li != libs.end(); ++li)
     {
     // Skip entries that will resolve to the target getting linked or

+ 2 - 2
Source/cmComputeLinkDepends.h

@@ -80,8 +80,8 @@ private:
   int AddLinkEntry(cmLinkItem const& item);
   void AddVarLinkEntries(int depender_index, const char* value);
   void AddDirectLinkEntries();
-  void AddLinkEntries(int depender_index,
-                      std::vector<cmLinkItem> const& libs);
+  template <typename T>
+    void AddLinkEntries(int depender_index, std::vector<T> const& libs);
   cmTarget const* FindTargetToLink(int depender_index,
                                    const std::string& name);