summaryrefslogtreecommitdiffstats
path: root/Source/cmOrderLinkDirectories.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-10-05 20:59:46 (GMT)
committerBrad King <brad.king@kitware.com>2006-10-05 20:59:46 (GMT)
commitbdf8e186e5084020a4cbbbe9aa2f63af0febf4ff (patch)
treef700b98be783c712b91a6ea4558c2df96c362493 /Source/cmOrderLinkDirectories.cxx
parente0a662a3ddfe3c906f81b0a070e4de169e46646e (diff)
downloadCMake-bdf8e186e5084020a4cbbbe9aa2f63af0febf4ff.zip
CMake-bdf8e186e5084020a4cbbbe9aa2f63af0febf4ff.tar.gz
CMake-bdf8e186e5084020a4cbbbe9aa2f63af0febf4ff.tar.bz2
BUG: Need to match shared library names before static because some platforms have static name patterns that match their shared patterns but not vice versa. This is needed for implementing bug#1644 on cygwin.
Diffstat (limited to 'Source/cmOrderLinkDirectories.cxx')
-rw-r--r--Source/cmOrderLinkDirectories.cxx35
1 files changed, 22 insertions, 13 deletions
diff --git a/Source/cmOrderLinkDirectories.cxx b/Source/cmOrderLinkDirectories.cxx
index fe00ec2..fb25711 100644
--- a/Source/cmOrderLinkDirectories.cxx
+++ b/Source/cmOrderLinkDirectories.cxx
@@ -267,19 +267,17 @@ void cmOrderLinkDirectories::PrepareLinkTargets()
for(std::vector<cmStdString>::iterator i = originalLinkItems.begin();
i != originalLinkItems.end(); ++i)
{
- // separate the library name from libfoo.a or foo.a
- if(this->ExtractStaticLibraryName.find(*i))
- {
-#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
- fprintf(stderr, "static regex matched [%s] [%s] [%s]\n",
- this->ExtractStaticLibraryName.match(1).c_str(),
- this->ExtractStaticLibraryName.match(2).c_str(),
- this->ExtractStaticLibraryName.match(3).c_str());
-#endif
- this->SetCurrentLinkType(LinkStatic);
- this->LinkItems.push_back(this->ExtractStaticLibraryName.match(2));
- }
- else if(this->ExtractSharedLibraryName.find(*i))
+ // Parse out the prefix, base, and suffix components of the
+ // library name. If the name matches that of a shared or static
+ // library then set the link type accordingly.
+ //
+ // Search for shared library names first because some platforms
+ // have shared libraries with names that match the static library
+ // pattern. For example cygwin and msys use the convention
+ // libfoo.dll.a for import libraries and libfoo.a for static
+ // libraries. On AIX a library with the name libfoo.a can be
+ // shared!
+ if(this->ExtractSharedLibraryName.find(*i))
{
#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
fprintf(stderr, "shared regex matched [%s] [%s] [%s]\n",
@@ -290,6 +288,17 @@ void cmOrderLinkDirectories::PrepareLinkTargets()
this->SetCurrentLinkType(LinkShared);
this->LinkItems.push_back(this->ExtractSharedLibraryName.match(2));
}
+ else if(this->ExtractStaticLibraryName.find(*i))
+ {
+#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG
+ fprintf(stderr, "static regex matched [%s] [%s] [%s]\n",
+ this->ExtractStaticLibraryName.match(1).c_str(),
+ this->ExtractStaticLibraryName.match(2).c_str(),
+ this->ExtractStaticLibraryName.match(3).c_str());
+#endif
+ this->SetCurrentLinkType(LinkStatic);
+ this->LinkItems.push_back(this->ExtractStaticLibraryName.match(2));
+ }
else if(this->ExtractAnyLibraryName.find(*i))
{
#ifdef CM_ORDER_LINK_DIRECTORIES_DEBUG