1
0
mirror of https://github.com/madler/zlib synced 2025-03-28 21:13:15 +00:00

CMake: Include bzip2 in the interface.

This commit is contained in:
Vollstrecker 2025-01-22 17:05:05 +01:00 committed by Mark Adler
parent 734f974753
commit 213998f2b0
2 changed files with 16 additions and 7 deletions

View File

@ -129,11 +129,11 @@ if(MINIZIP_BUILD_SHARED)
target_compile_definitions(
libminizip
PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
$<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>)
if(NOT CYGWIN)
set_target_properties(libminizip PROPERTIES SOVERSION
@ -146,7 +146,10 @@ if(MINIZIP_BUILD_SHARED)
OUTPUT_NAME minizip
VERSION ${minizip_VERSION}
SOVERSION ${minizip_VERSION_MAJOR})
target_link_libraries(libminizip PUBLIC ZLIB::ZLIB)
target_link_libraries(libminizip
PUBLIC ZLIB::ZLIB
$<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
add_executable(minizip ${MINIZIP_SRCS} ${MINIZIP_HDRS})
set_target_properties(minizip PROPERTIES EXPORT_NAME minizip_executable)
@ -172,11 +175,11 @@ if(MINIZIP_BUILD_STATIC)
target_compile_definitions(
libminizipstatic
PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
$<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>)
set_target_properties(
libminizipstatic PROPERTIES EXPORT_NAME minizipstatic
OUTPUT_NAME minizip${minizip_static_suffix})
@ -185,7 +188,9 @@ if(MINIZIP_BUILD_STATIC)
set_target_properties(libminizipstatic PROPERTIES SUFFIX ".dll.a")
endif(CYGWIN)
target_link_libraries(libminizipstatic PUBLIC ZLIB::ZLIBSTATIC)
target_link_libraries(libminizipstatic PUBLIC ZLIB::ZLIBSTATIC
$<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
add_executable(minizipstatic ${MINIZIP_SRCS} ${MINIZIP_HDRS})
set_target_properties(minizipstatic PROPERTIES EXPORT_NAME
minizip_static_executable)

View File

@ -1,8 +1,8 @@
@PACKAGE_INIT@
set(MINIZIP_ENABLE_BZIP2 @MINIZIP_ENABLE_BZIP2@)
set(_minizip_supported_components "")
include(CMakeFindDependencyMacro)
if(@MINIZIP_BUILD_SHARED@)
list(APPEND _minizip_supported_components shared)
endif(@MINIZIP_BUILD_SHARED@)
@ -11,6 +11,10 @@ if(@MINIZIP_BUILD_STATIC@)
list(APPEND _minizip_supported_components static)
endif(@MINIZIP_BUILD_STATIC@)
if(@MINIZIP_ENABLE_BZIP2@)
find_dependency(BZip2)
endif(@MINIZIP_ENABLE_BZIP2@)
if(minizip_FIND_COMPONENTS)
find_dependency(ZLIB CONFIG COMPONENTS ${minizip_FIND_COMPONENTS})