diff options
-rw-r--r-- | Help/release/dev/link-line-dedup.rst | 5 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmComputeLinkDepends.cxx | 15 |
3 files changed, 19 insertions, 3 deletions
diff --git a/Help/release/dev/link-line-dedup.rst b/Help/release/dev/link-line-dedup.rst new file mode 100644 index 0000000..6ce31e3 --- /dev/null +++ b/Help/release/dev/link-line-dedup.rst @@ -0,0 +1,5 @@ +link-line-dedup +--------------- + +* When generating linker command-lines, CMake now avoids repeating + items corresponding to SHARED library targets. diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ea892aa..2952b93 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140731) +set(CMake_VERSION_PATCH 20140804) #set(CMake_VERSION_RC 1) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index c13da50..b13a125 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -166,7 +166,8 @@ guaranteed to be acyclic. The final list of items produced by this procedure consists of the original user link line followed by minimal additional items needed to -satisfy dependencies. +satisfy dependencies. The final list is then filtered to de-duplicate +items that we know the linker will re-use automatically (shared libs). */ @@ -262,10 +263,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. |