[PATCH] D138361: [cmake] Fix Findzstd.cmake to handle OpenBSD shared libraries

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 21:51:21 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5279e6a7d677: [cmake] Fix Findzstd.cmake to handle OpenBSD shared libraries (authored by mgorny).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138361/new/

https://reviews.llvm.org/D138361

Files:
  llvm/cmake/modules/Findzstd.cmake


Index: llvm/cmake/modules/Findzstd.cmake
===================================================================
--- llvm/cmake/modules/Findzstd.cmake
+++ llvm/cmake/modules/Findzstd.cmake
@@ -11,10 +11,8 @@
 # zstd::libzstd_static
 
 if(MSVC)
-  set(zstd_SHARED_LIBRARY_SUFFIX "\\${CMAKE_LINK_LIBRARY_SUFFIX}$")
   set(zstd_STATIC_LIBRARY_SUFFIX "_static\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
 else()
-  set(zstd_SHARED_LIBRARY_SUFFIX "\\${CMAKE_SHARED_LIBRARY_SUFFIX}$")
   set(zstd_STATIC_LIBRARY_SUFFIX "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
 endif()
 
@@ -31,8 +29,9 @@
 )
 
 if(zstd_FOUND)
-  if(zstd_LIBRARY MATCHES "${zstd_SHARED_LIBRARY_SUFFIX}$" AND
-     NOT TARGET zstd::libzstd_shared)
+  if(zstd_LIBRARY MATCHES "${zstd_STATIC_LIBRARY_SUFFIX}$")
+    set(zstd_STATIC_LIBRARY "${zstd_LIBRARY}")
+  elseif (NOT TARGET zstd::libzstd_shared)
     add_library(zstd::libzstd_shared SHARED IMPORTED)
     if(MSVC)
       # IMPORTED_LOCATION is the path to the DLL and IMPORTED_IMPLIB is the "library".
@@ -51,8 +50,6 @@
           INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
           IMPORTED_LOCATION "${zstd_LIBRARY}")
     endif()
-  else()
-    set(zstd_STATIC_LIBRARY "${zstd_LIBRARY}")
   endif()
   if(zstd_STATIC_LIBRARY MATCHES "${zstd_STATIC_LIBRARY_SUFFIX}$" AND
      NOT TARGET zstd::libzstd_static)
@@ -63,7 +60,6 @@
   endif()
 endif()
 
-unset(zstd_SHARED_LIBRARY_SUFFIX)
 unset(zstd_STATIC_LIBRARY_SUFFIX)
 
 mark_as_advanced(zstd_INCLUDE_DIR zstd_LIBRARY zstd_STATIC_LIBRARY)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138361.477380.patch
Type: text/x-patch
Size: 1502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221123/8dd29fc4/attachment.bin>


More information about the llvm-commits mailing list