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

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 20 01:48:56 PST 2022


phosek added inline comments.


================
Comment at: llvm/cmake/modules/Findzstd.cmake:34-55
+  else()
+    if (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".
+        get_filename_component(zstd_DIRNAME "${zstd_LIBRARY}" DIRECTORY)
+        string(REGEX REPLACE "${CMAKE_INSTALL_LIBDIR}$" "${CMAKE_INSTALL_BINDIR}" zstd_DIRNAME "${zstd_DIRNAME}")
----------------
This could be combined to an `elseif` block.


================
Comment at: llvm/cmake/modules/Findzstd.cmake:56-62
   if(zstd_STATIC_LIBRARY MATCHES "${zstd_STATIC_LIBRARY_SUFFIX}$" AND
      NOT TARGET zstd::libzstd_static)
     add_library(zstd::libzstd_static STATIC IMPORTED)
     set_target_properties(zstd::libzstd_static PROPERTIES
         INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
         IMPORTED_LOCATION "${zstd_STATIC_LIBRARY}")
   endif()
----------------
I'd consider combining this `if` block with the `if` block above.


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

https://reviews.llvm.org/D138361



More information about the llvm-commits mailing list