[cmake-commits] king committed cmLocalGenerator.cxx 1.158 1.159 cmOrderLinkDirectories.cxx 1.32 1.33

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Oct 5 16:59:48 EDT 2006


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv18148

Modified Files:
	cmLocalGenerator.cxx cmOrderLinkDirectories.cxx 
Log Message:
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.


Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- cmLocalGenerator.cxx	5 Oct 2006 19:08:19 -0000	1.158
+++ cmLocalGenerator.cxx	5 Oct 2006 20:59:46 -0000	1.159
@@ -1716,6 +1716,12 @@
     this->Makefile->GetDefinition("CMAKE_STATIC_LIBRARY_PREFIX"));
   orderLibs.AddLinkPrefix(
     this->Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_PREFIX"));
+
+  // Import library names should be matched and treated as shared
+  // libraries for the purposes of linking.
+  orderLibs.AddLinkExtension(
+    this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"),
+    cmOrderLinkDirectories::LinkShared);
   orderLibs.AddLinkExtension(
     this->Makefile->GetDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"),
     cmOrderLinkDirectories::LinkStatic);
@@ -1723,8 +1729,6 @@
     this->Makefile->GetDefinition("CMAKE_SHARED_LIBRARY_SUFFIX"),
     cmOrderLinkDirectories::LinkShared);
   orderLibs.AddLinkExtension(
-    this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"));
-  orderLibs.AddLinkExtension(
     this->Makefile->GetDefinition("CMAKE_LINK_LIBRARY_SUFFIX"));
   if(const char* linkSuffixes =
      this->Makefile->GetDefinition("CMAKE_EXTRA_LINK_EXTENSIONS"))

Index: cmOrderLinkDirectories.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmOrderLinkDirectories.cxx,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cmOrderLinkDirectories.cxx	5 Oct 2006 19:08:19 -0000	1.32
+++ cmOrderLinkDirectories.cxx	5 Oct 2006 20:59:46 -0000	1.33
@@ -267,19 +267,17 @@
   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 @@
       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



More information about the Cmake-commits mailing list