Update factory script to use custom CMake including de-duplicate shared libs patch

// -----------------------------------
From f6df98a1036fb1555b95482201c6896940b16d21 Mon Sep 17 00:00:00 2001
Message-Id: <f6df98a1036fb1555b95482201c6896940b16d21.1403721058.git.brad.king@kitware.com>
From: Brad King <brad.king@kitware.com>
Date: Wed, 25 Jun 2014 14:27:42 -0400
Subject: [PATCH] De-duplicate shared library targets in generated link lines

The linker will bring in shared libraries as a whole and use them even
for symbols that are needed by entries later in the link line.
Therefore we do not need to repeat them.  De-duplicate link entries that
we know are shared libraries because we have a cmTarget associated with
them.
---
 Source/cmComputeLinkDepends.cxx | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 6170e92..8883bc0 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -262,10 +262,20 @@ cmComputeLinkDepends::Compute()
   this->OrderLinkEntires();

   // Compute the final set of link entries.
+  std::set<int> emmitted;
   for(std::vector<int>::const_iterator li = this->FinalLinkOrder.begin();
       li != this->FinalLinkOrder.end(); ++li)
     {
-    this->FinalLinkEntries.push_back(this->EntryList[*li]);
+    int i = *li;
+    LinkEntry const& e = this->EntryList[i];
+    cmTarget const* t = e.Target;
+    // Entries that we know the linker will re-use for symbols
+    // needed by later entries do not need to be repeated.
+    bool uniquify = t && t->GetType() == cmTarget::SHARED_LIBRARY;
+    if(!uniquify || emmitted.insert(i).second)
+      {
+      this->FinalLinkEntries.push_back(e);
+      }
     }

   // Display the final set.
--
2.0.0
// -----------------------------------