Skip to content

Commit

Permalink
cmake: add fallback method to finding zlib
Browse files Browse the repository at this point in the history
  • Loading branch information
LDVG committed Nov 27, 2024
1 parent fae3b4e commit d2569d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand All @@ -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)
Expand Down

0 comments on commit d2569d6

Please sign in to comment.