vcpkg/ports/fbthrift/fix-zlib.patch

101 lines
3.0 KiB
Diff
Raw Normal View History

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 150671504a9..7b248a0105e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,7 +106,7 @@ if(lib_only OR build_all)
find_package(fizz CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(wangle CONFIG REQUIRED)
- find_package(Zlib REQUIRED)
+ find_package(ZLIB REQUIRED)
find_package(Zstd REQUIRED)
# https://cmake.org/cmake/help/v3.9/module/FindThreads.html
set(THREADS_PREFER_PTHREAD_FLAG ON)
@@ -115,7 +115,6 @@ if(lib_only OR build_all)
${LIBGFLAGS_INCLUDE_DIR}
${GLOG_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
- ${ZLIB_INCLUDE_DIRS}
${ZSTD_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
diff --git a/thrift/cmake/FBThriftConfig.cmake.in b/thrift/cmake/FBThriftConfig.cmake.in
index 69b29b948c5..e1297ed18c3 100644
--- a/thrift/cmake/FBThriftConfig.cmake.in
+++ b/thrift/cmake/FBThriftConfig.cmake.in
@@ -28,6 +28,8 @@ else()
set_and_check(FBTHRIFT_COMPILER "@PACKAGE_BIN_INSTALL_DIR@/thrift1")
endif()
+find_dependency(ZLIB REQUIRED)
+
if (NOT TARGET FBThrift::thriftcpp2)
include("${FBTHRIFT_CMAKE_DIR}/FBThriftTargets.cmake")
endif()
diff --git a/thrift/cmake/FindZlib.cmake b/thrift/cmake/FindZlib.cmake
deleted file mode 100644
index c15525b411f..00000000000
--- a/thrift/cmake/FindZlib.cmake
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) Facebook, Inc. and its affiliates.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#
-# - Try to find Facebook zstd library
-# This will define
-# ZLIB_FOUND
-# ZLIB_INCLUDE_DIR
-# ZLIB_LIBRARIES
-#
-
-find_path(
- ZLIB_INCLUDE_DIRS zlib.h
- HINTS
- $ENV{ZLIB_ROOT}/include
- ${ZLIB_ROOT}/include
-)
-
-find_library(
- ZLIB_LIBRARIES z zlib
- HINTS
- $ENV{ZLIB_ROOT}/lib
- ${ZLIB_ROOT}/lib
-)
-
-# For some reason ZLIB_FOUND is never marked as TRUE
-set(ZLIB_FOUND TRUE)
-mark_as_advanced(ZLIB_INCLUDE_DIRS ZLIB_LIBRARIES)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Zstd ZLIB_INCLUDE_DIRS ZLIB_LIBRARIES)
-
-if(ZLIB_FOUND AND NOT ZLIB_FIND_QUIETLY)
- message(STATUS "ZLIB: ${ZLIB_INCLUDE_DIRS}")
-endif()
diff --git a/thrift/lib/cpp/CMakeLists.txt b/thrift/lib/cpp/CMakeLists.txt
index 681622594c9..3df0b5717db 100644
--- a/thrift/lib/cpp/CMakeLists.txt
+++ b/thrift/lib/cpp/CMakeLists.txt
@@ -77,8 +77,8 @@ target_link_libraries(
thrift-core
rpcmetadata
Folly::folly
+ ZLIB::ZLIB
${OPENSSL_LIBRARIES}
- ${ZLIB_LIBRARIES}
${ZSTD_LIBRARIES}
)