From d2569d666057e0e8ccc7ad41bbdf067174fd6126 Mon Sep 17 00:00:00 2001 From: Ludvig Michaelsson Date: Wed, 27 Nov 2024 13:46:28 +0100 Subject: [PATCH] cmake: add fallback method to finding zlib --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd597aa6..73a59fd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,7 @@ check_include_files(openssl/opensslv.h HAVE_OPENSSLV_H) check_include_files(signal.h HAVE_SIGNAL_H) check_include_files(sys/random.h HAVE_SYS_RANDOM_H) check_include_files(unistd.h HAVE_UNISTD_H) +check_include_files(zlib.h HAVE_ZLIB_H) check_symbol_exists(arc4random_buf stdlib.h HAVE_ARC4RANDOM_BUF) check_symbol_exists(asprintf stdio.h HAVE_ASPRINTF) @@ -230,7 +231,7 @@ else() if(NOT CRYPTO_FOUND AND NOT HAVE_OPENSSLV_H) message(FATAL_ERROR "could not find libcrypto") endif() - if(NOT ZLIB_FOUND) + if(NOT ZLIB_FOUND AND NOT HAVE_ZLIB_H) message(FATAL_ERROR "could not find zlib") endif() @@ -240,6 +241,9 @@ else() if(NOT CRYPTO_LIBRARIES) set(CRYPTO_LIBRARIES "crypto") endif() + if(NOT ZLIB_LIBRARIES) + set(ZLIB_LIBRARIES "z") + endif() if(CMAKE_SYSTEM_NAME STREQUAL "Linux") pkg_search_module(UDEV libudev REQUIRED)