vcpkg/ports/leveldb/fix-dependencies.patch
Jack·Boos·Yu 81d6c5ec18
[leveldb] Fix find and use depencencies (#23048)
* [leveldb] Fix find and use depencencies

* version

* Update ports/leveldb/portfile.cmake

Co-authored-by: LilyWangLL <94091114+LilyWangLL@users.noreply.github.com>

* Update ports/leveldb/portfile.cmake

Co-authored-by: LilyWangLL <94091114+LilyWangLL@users.noreply.github.com>

* Update versions/l-/leveldb.json

Co-authored-by: LilyWangLL <94091114+LilyWangLL@users.noreply.github.com>
2022-02-15 20:34:42 -08:00

35 lines
1.0 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 98b87dc..76d2e9b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,8 +35,14 @@ include(CheckIncludeFile)
check_include_file("unistd.h" HAVE_UNISTD_H)
include(CheckLibraryExists)
-check_library_exists(crc32c crc32c_value "" HAVE_CRC32C)
-check_library_exists(snappy snappy_compress "" HAVE_SNAPPY)
+if (WITH_CRC32C)
+ find_package(Crc32c CONFIG REQUIRED)
+ set(HAVE_CRC32C 1)
+endif()
+if (WITH_SNAPPY)
+ find_package(Snappy CONFIG REQUIRED)
+ set(HAVE_SNAPPY 1)
+endif()
check_library_exists(tcmalloc malloc "" HAVE_TCMALLOC)
include(CheckCXXSymbolExists)
@@ -246,10 +252,10 @@ if(HAVE_CLANG_THREAD_SAFETY)
endif(HAVE_CLANG_THREAD_SAFETY)
if(HAVE_CRC32C)
- target_link_libraries(leveldb crc32c)
+ target_link_libraries(leveldb Crc32c::crc32c)
endif(HAVE_CRC32C)
if(HAVE_SNAPPY)
- target_link_libraries(leveldb snappy)
+ target_link_libraries(leveldb Snappy::snappy)
endif(HAVE_SNAPPY)
if(HAVE_TCMALLOC)
target_link_libraries(leveldb tcmalloc)