Browse Source

cmExportFileGenerator: Make SetImportLinkProperty a template

Allow the vector of property entries to have any element type
that can convert to std::string.
Brad King 11 years ago
parent
commit
edce43514d
2 changed files with 7 additions and 5 deletions
  1. 4 4
      Source/cmExportFileGenerator.cxx
  2. 3 1
      Source/cmExportFileGenerator.h

+ 4 - 4
Source/cmExportFileGenerator.cxx

@@ -865,15 +865,16 @@ cmExportFileGenerator
 }
 
 //----------------------------------------------------------------------------
+template <typename T>
 void
 cmExportFileGenerator
 ::SetImportLinkProperty(std::string const& suffix,
                         cmTarget* target,
                         const std::string& propName,
-                        std::vector<std::string> const& entries,
+                        std::vector<T> const& entries,
                         ImportPropertyMap& properties,
                         std::vector<std::string>& missingTargets
-                       )
+  )
 {
   // Skip the property if there are no entries.
   if(entries.empty())
@@ -884,7 +885,7 @@ cmExportFileGenerator
   // Construct the property value.
   std::string link_entries;
   const char* sep = "";
-  for(std::vector<std::string>::const_iterator li = entries.begin();
+  for(typename std::vector<T>::const_iterator li = entries.begin();
       li != entries.end(); ++li)
     {
     // Separate this from the previous entry.
@@ -902,7 +903,6 @@ cmExportFileGenerator
   properties[prop] = link_entries;
 }
 
-
 //----------------------------------------------------------------------------
 void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os,
                                                     const std::string& config)

+ 3 - 1
Source/cmExportFileGenerator.h

@@ -95,9 +95,11 @@ protected:
                                  std::string const& suffix, cmTarget* target,
                                  ImportPropertyMap& properties,
                                  std::vector<std::string>& missingTargets);
+
+  template <typename T>
   void SetImportLinkProperty(std::string const& suffix,
                              cmTarget* target, const std::string& propName,
-                             std::vector<std::string> const& entries,
+                             std::vector<T> const& entries,
                              ImportPropertyMap& properties,
                              std::vector<std::string>& missingTargets);