[PATCH] D135457: [llvm] [cmake] Support finding both static and shared zstd via FindZstd
Michał Górny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 11 22:15:04 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG56f94ede2af9: [llvm] [cmake] Support finding both static and shared zstd via FindZstd (authored by mgorny).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135457/new/
https://reviews.llvm.org/D135457
Files:
llvm/cmake/modules/Findzstd.cmake
Index: llvm/cmake/modules/Findzstd.cmake
===================================================================
--- llvm/cmake/modules/Findzstd.cmake
+++ llvm/cmake/modules/Findzstd.cmake
@@ -3,6 +3,7 @@
# If successful, the following variables will be defined:
# zstd_INCLUDE_DIR
# zstd_LIBRARY
+# zstd_STATIC_LIBRARY
# zstd_FOUND
#
# Additionally, one of the following import targets will be defined:
@@ -19,6 +20,9 @@
find_path(zstd_INCLUDE_DIR NAMES zstd.h)
find_library(zstd_LIBRARY NAMES zstd zstd_static)
+find_library(zstd_STATIC_LIBRARY NAMES
+ zstd_static
+ "${CMAKE_STATIC_LIBRARY_PREFIX}zstd${CMAKE_STATIC_LIBRARY_SUFFIX}")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
@@ -33,17 +37,19 @@
set_target_properties(zstd::libzstd_shared PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
IMPORTED_LOCATION "${zstd_LIBRARY}")
+ else()
+ set(zstd_STATIC_LIBRARY "${zstd_LIBRARY}")
endif()
- if(zstd_LIBRARY MATCHES "${zstd_STATIC_LIBRARY_SUFFIX}$" AND
+ 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_LIBRARY}")
+ IMPORTED_LOCATION "${zstd_STATIC_LIBRARY}")
endif()
endif()
unset(zstd_SHARED_LIBRARY_SUFFIX)
unset(zstd_STATIC_LIBRARY_SUFFIX)
-mark_as_advanced(zstd_INCLUDE_DIR zstd_LIBRARY)
+mark_as_advanced(zstd_INCLUDE_DIR zstd_LIBRARY zstd_STATIC_LIBRARY)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135457.467019.patch
Type: text/x-patch
Size: 1642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221012/0f5ba609/attachment.bin>
More information about the llvm-commits
mailing list