diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b4f47a..3d90152 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ endif() include(CMakeDependentOption) -if(MSVC) +if(MSVC AND NOT VCPKG_TOOLCHAIN) option(WITH_GFLAGS "build with GFlags" OFF) option(WITH_XPRESS "build with windows built in compression" OFF) option(ROCKSDB_SKIP_THIRDPARTY "skip thirdparty.inc" OFF) @@ -136,10 +136,7 @@ else() endif() if(WITH_SNAPPY) - find_package(Snappy CONFIG) - if(NOT Snappy_FOUND) - find_package(Snappy REQUIRED) - endif() + find_package(Snappy CONFIG REQUIRED) add_definitions(-DSNAPPY) list(APPEND THIRDPARTY_LIBS Snappy::snappy) endif() @@ -163,16 +160,19 @@ else() endif() if(WITH_LZ4) - find_package(lz4 REQUIRED) + find_package(lz4 CONFIG REQUIRED) add_definitions(-DLZ4) list(APPEND THIRDPARTY_LIBS lz4::lz4) endif() if(WITH_ZSTD) - find_package(zstd REQUIRED) + find_package(zstd CONFIG REQUIRED) add_definitions(-DZSTD) - include_directories(${ZSTD_INCLUDE_DIR}) - list(APPEND THIRDPARTY_LIBS zstd::zstd) + if(TARGET zstd::libzstd_shared) + list(APPEND THIRDPARTY_LIBS zstd::libzstd_shared) + elseif(TARGET zstd::libzstd_static) + list(APPEND THIRDPARTY_LIBS zstd::libzstd_static) + endif() endif() endif() @@ -402,9 +402,9 @@ endif() option(WITH_TBB "build with Threading Building Blocks (TBB)" OFF) if(WITH_TBB) - find_package(TBB REQUIRED) + find_package(TBB CONFIG REQUIRED) add_definitions(-DTBB) - list(APPEND THIRDPARTY_LIBS TBB::TBB) + list(APPEND THIRDPARTY_LIBS TBB::tbb) endif() # Stall notifications eat some performance from inserts