From 3d94e052f987bc35452592acf9f6fcb0d4ee4db4 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 10 Jun 2020 11:39:17 +0100 Subject: [PATCH] Allow libbsd to be explicitly disabled When building for a minimal environment like OpenWRT we want to avoid the dependency on libbsd even if it did happen to be built and available in the buildroot at the time minizip is compiled. https://github.com/openwrt/packages/issues/12471 --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0de10cf..217359a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ option(MZ_PKCRYPT "Enables PKWARE traditional encryption" ON) option(MZ_WZAES "Enables WinZIP AES encryption" ON) option(MZ_LIBCOMP "Enables Apple compression" OFF) option(MZ_OPENSSL "Enables OpenSSL for encryption" OFF) +option(MZ_LIBBSD "Enable libbsd random functionality" ON) option(MZ_BRG "Enables Brian Gladman's encryption library" OFF) option(MZ_SIGNING "Enables zip signing support" ON) option(MZ_COMPRESS_ONLY "Only support compression" OFF) @@ -275,7 +276,7 @@ if(UNIX) endif() endif() - if(NOT HAVE_ARC4RANDOM_BUF) + if(MZ_LIBBSD AND NOT HAVE_ARC4RANDOM_BUF) find_package(PkgConfig REQUIRED) pkg_check_modules(LIBBSD libbsd) @@ -288,6 +289,8 @@ if(UNIX) list(APPEND MINIZIP_INC ${LIBBSD_INCLUDE_DIRS}) link_directories(${LIBBSD_LIBRARY_DIRS}) endif() + else() + set(MZ_LIBBSD FALSE) endif() endif() endif() @@ -935,6 +938,7 @@ add_feature_info(MZ_PKCRYPT MZ_PKCRYPT "Enables PKWARE traditional encryption") add_feature_info(MZ_WZAES MZ_WZAES "Enables WinZIP AES encryption") add_feature_info(MZ_LIBCOMP MZ_LIBCOMP "Enables Apple compression") add_feature_info(MZ_OPENSSL MZ_OPENSSL "Enables OpenSSL for encryption") +add_feature_info(MZ_LIBBSD MZ_LIBBSD "Build with libbsd for random functionality") add_feature_info(MZ_BRG MZ_BRG "Enables Brian Gladman's encryption library") add_feature_info(MZ_SIGNING MZ_SIGNING "Enables zip signing support") add_feature_info(MZ_COMPRESS_ONLY MZ_COMPRESS_ONLY "Only support compression") -- 2.17.1