瀏覽代碼

BUG: Recognize .so shared libraries on HP-UX

HP-UX uses both .sl and .so as extensions for shared libraries.  This
teaches CMake to recognize .so shared libraries so they are treated
properly during link dependency analysis.
Brad King 16 年之前
父節點
當前提交
d2b108150f
共有 3 個文件被更改,包括 21 次插入0 次删除
  1. 1 0
      Modules/Platform/HP-UX.cmake
  2. 11 0
      Source/cmComputeLinkInformation.cxx
  3. 9 0
      Source/cmDocumentVariables.cxx

+ 1 - 0
Modules/Platform/HP-UX.cmake

@@ -1,6 +1,7 @@
 SET(CMAKE_SHARED_LIBRARY_SUFFIX ".sl")          # .so
 SET(CMAKE_DL_LIBS "dld")
 SET(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a")
+SET(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so")
 
 # The HP linker needs to find transitive shared library dependencies
 # in the -L path.  Therefore the runtime path must be added to the

+ 11 - 0
Source/cmComputeLinkInformation.cxx

@@ -814,6 +814,17 @@ void cmComputeLinkInformation::ComputeItemParserInfo()
       this->AddLinkExtension(i->c_str(), LinkUnknown);
       }
     }
+  if(const char* sharedSuffixes =
+     mf->GetDefinition("CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES"))
+    {
+    std::vector<std::string> sharedSuffixVec;
+    cmSystemTools::ExpandListArgument(sharedSuffixes, sharedSuffixVec);
+    for(std::vector<std::string>::iterator i = sharedSuffixVec.begin();
+        i != sharedSuffixVec.end(); ++i)
+      {
+      this->AddLinkExtension(i->c_str(), LinkShared);
+      }
+    }
 
   // Compute a regex to match link extensions.
   std::string libext = this->CreateExtensionRegex(this->LinkExtensions);

+ 9 - 0
Source/cmDocumentVariables.cxx

@@ -377,6 +377,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
      "The suffix to use for the end of a static library, .lib on Windows.",
      false,
      "Variables that Provide Information");
+  cm->DefineProperty
+    ("CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES", cmProperty::VARIABLE,
+     "Additional suffixes for shared libraries.",
+     "Extensions for shared libraries other than that specified by "
+     "CMAKE_SHARED_LIBRARY_SUFFIX, if any.  "
+     "CMake uses this to recognize external shared library files during "
+     "analysis of libraries linked by a target.",
+     false,
+     "Variables that Provide Information");
 
 
   // Variables defined by cmake, that change the behavior