$OpenBSD: patch-Source_cmComputeLinkInformation_cxx,v 1.18 2016/11/28 09:15:13 dcoppa Exp $
--- Source/cmComputeLinkInformation.cxx.orig	Fri Nov 11 15:37:14 2016
+++ Source/cmComputeLinkInformation.cxx	Fri Nov 25 22:31:45 2016
@@ -445,6 +445,8 @@ cmComputeLinkInformation::GetSharedLibrariesLinked()
 
 bool cmComputeLinkInformation::Compute()
 {
+  bool use_wxneeded = false;
+
   // Skip targets that do not link.
   if (!(this->Target->GetType() == cmState::EXECUTABLE ||
         this->Target->GetType() == cmState::SHARED_LIBRARY ||
@@ -473,10 +475,17 @@ bool cmComputeLinkInformation::Compute()
     if (lei->IsSharedDep) {
       this->AddSharedDepItem(lei->Item, lei->Target);
     } else {
+      std::string litem_tolower = lei->Item;
+      transform(litem_tolower.begin(), litem_tolower.end(), litem_tolower.begin(), ::tolower);
+      if (litem_tolower.find("webkit") != std::string::npos)
+        use_wxneeded = true;
       this->AddItem(lei->Item, lei->Target);
     }
   }
 
+  if (use_wxneeded == true)
+    this->AddUserItem("-Wl,-z,wxneeded", false);
+
   // Restore the target link type so the correct system runtime
   // libraries are found.
   const char* lss = this->Target->GetProperty("LINK_SEARCH_END_STATIC");
@@ -627,10 +636,16 @@ void cmComputeLinkInformation::AddItem(std::string con
         // This is a directory.
         this->AddDirectoryItem(item);
       } else {
-        // Use the full path given to the library file.
         this->Depends.push_back(item);
-        this->AddFullItem(item);
-        this->AddLibraryRuntimeInfo(item);
+        if (!this->OpenBSD) {
+          // Use the full path given to the library file.
+          this->AddFullItem(item);
+          this->AddLibraryRuntimeInfo(item);
+        } else {
+          std::string file = cmSystemTools::GetFilenameName(item);
+          this->AddUserItem(file, false);
+          this->OrderLinkerSearchPath->AddLinkLibrary(item);
+        }
       }
     } else {
       // This is a library or option specified by the user.
@@ -973,11 +988,18 @@ void cmComputeLinkInformation::AddTargetItem(std::stri
     this->SharedLibrariesLinked.insert(target);
   }
 
-  // Handle case of an imported shared library with no soname.
-  if (this->NoSONameUsesPath &&
-      target->IsImportedSharedLibWithoutSOName(this->Config)) {
-    this->AddSharedLibNoSOName(item);
-    return;
+  if (this->OpenBSD) {
+    if (target->GetType() == cmState::SHARED_LIBRARY) {
+      this->AddSharedLibNoSOName(item);
+      return;
+    }
+  } else {
+    // Handle case of an imported shared library with no soname.
+    if (this->NoSONameUsesPath &&
+        target->IsImportedSharedLibWithoutSOName(this->Config)) {
+      this->AddSharedLibNoSOName(item);
+      return;
+    }
   }
 
   // If this platform wants a flag before the full path, add it.
