summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkDepends.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-04-30 22:04:48 (GMT)
committerBrad King <brad.king@kitware.com>2008-04-30 22:04:48 (GMT)
commit3a5bdaa21319665405104964562dd471aee7cb48 (patch)
tree935e1dea807312fc591a429f340dc3efe744c944 /Source/cmComputeLinkDepends.cxx
parent9631c499dc31ea1aba70201afc1a565b84c33620 (diff)
downloadCMake-3a5bdaa21319665405104964562dd471aee7cb48.zip
CMake-3a5bdaa21319665405104964562dd471aee7cb48.tar.gz
CMake-3a5bdaa21319665405104964562dd471aee7cb48.tar.bz2
ENH: When preserving potentially static portions of original user link lines recognize shared library names by their extension and skip them.
Diffstat (limited to 'Source/cmComputeLinkDepends.cxx')
-rw-r--r--Source/cmComputeLinkDepends.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 72dd198..305c06d 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -24,6 +24,7 @@
#include "cmake.h"
#include <cmsys/stl/algorithm>
+#include <cmsys/RegularExpression.hxx>
#include <assert.h>
@@ -198,6 +199,12 @@ void cmComputeLinkDepends::SetOldLinkDirMode(bool b)
}
//----------------------------------------------------------------------------
+void cmComputeLinkDepends::SetSharedRegex(std::string const& regex)
+{
+ this->SharedRegexString = regex;
+}
+
+//----------------------------------------------------------------------------
std::vector<cmComputeLinkDepends::LinkEntry> const&
cmComputeLinkDepends::Compute()
{
@@ -874,6 +881,9 @@ void cmComputeLinkDepends::CheckWrongConfigItem(std::string const& item)
//----------------------------------------------------------------------------
void cmComputeLinkDepends::PreserveOriginalEntries()
{
+ // Regular expression to match shared libraries.
+ cmsys::RegularExpression shared_lib(this->SharedRegexString.c_str());
+
// Skip the part of the input sequence that already appears in the
// output.
std::vector<int>::const_iterator in = this->OriginalEntries.begin();
@@ -882,7 +892,8 @@ void cmComputeLinkDepends::PreserveOriginalEntries()
out != this->FinalLinkOrder.end())
{
cmTarget* tgt = this->EntryList[*in].Target;
- if(tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY)
+ if((tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY) ||
+ (!tgt && shared_lib.find(this->EntryList[*in].Item)))
{
// Skip input items known to not be static libraries.
++in;
@@ -905,7 +916,8 @@ void cmComputeLinkDepends::PreserveOriginalEntries()
while(in != this->OriginalEntries.end())
{
cmTarget* tgt = this->EntryList[*in].Target;
- if(tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY)
+ if((tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY) ||
+ (!tgt && shared_lib.find(this->EntryList[*in].Item)))
{
// Skip input items known to not be static libraries.
++in;