2011-08-19 23:38:05 +00:00
|
|
|
project(minizip)
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
2011-08-22 15:37:53 +00:00
|
|
|
if (UNIX)
|
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
endif()
|
2011-08-19 23:38:05 +00:00
|
|
|
|
|
|
|
set (SOURCES
|
|
|
|
ioapi.c
|
|
|
|
unzip.c
|
|
|
|
zip.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set (HEADERS
|
|
|
|
ioapi.h
|
|
|
|
unzip.h
|
|
|
|
zip.h
|
|
|
|
)
|
|
|
|
|
2011-08-22 13:19:07 +00:00
|
|
|
if (APPLE)
|
|
|
|
# Mac OS X does not have fopen64()
|
|
|
|
# and several related functions as the standard fopen()
|
|
|
|
# calls are 64bit
|
|
|
|
add_definitions("-DUSE_FILE32API")
|
|
|
|
endif()
|
|
|
|
|
2011-09-05 13:51:36 +00:00
|
|
|
add_definitions("-DHAVE_BZIP2")
|
|
|
|
|
2011-08-19 23:38:05 +00:00
|
|
|
add_library(minizip
|
|
|
|
${SOURCES}
|
|
|
|
${HEADERS}
|
|
|
|
)
|
|
|
|
|
2011-08-22 15:37:53 +00:00
|
|
|
if (UNIX)
|
2011-10-03 10:49:26 +00:00
|
|
|
# on Mac, link to libbz2 dynamically, on Linux
|
|
|
|
# we link statically to libbz2 so that an updater binary
|
|
|
|
# build on Debian (where the packaged libbz2 has a SONAME of "libbz2.so.1.0"
|
|
|
|
# works on Fedora/openSUSE (where no libbz2.so.1.0 symlink exists)
|
|
|
|
#
|
|
|
|
# see http://stackoverflow.com/questions/1835489/linking-an-application-to-libbz2-so-1-rather-than-libbz2-so-1-0
|
|
|
|
#
|
|
|
|
set(BZ2_LIB_NAME bz2)
|
|
|
|
if (NOT APPLE)
|
|
|
|
set(BZ2_LIB_NAME bz2.a)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_link_libraries(minizip z ${BZ2_LIB_NAME})
|
2011-08-22 15:37:53 +00:00
|
|
|
else()
|
2011-09-05 14:47:40 +00:00
|
|
|
target_link_libraries(minizip
|
2011-09-15 17:34:45 +00:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../zlib/prebuilt/zlib_static.lib"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../bzip2/libbz2_static.lib"
|
2011-09-05 14:47:40 +00:00
|
|
|
)
|
2011-08-22 15:37:53 +00:00
|
|
|
endif()
|
|
|
|
|
2011-08-19 23:38:05 +00:00
|
|
|
|