vcpkg/ports/minizip/CMakeLists.txt

78 lines
1.7 KiB
CMake
Raw Normal View History

2017-07-22 13:00:32 +08:00
cmake_minimum_required(VERSION 3.8)
2017-07-24 01:57:20 +08:00
project(minizip C)
2017-07-22 13:00:32 +08:00
if(MSVC)
add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS)
endif()
find_package(ZLIB REQUIRED)
find_package(Bzip2 REQUIRED)
set(MIN_SRC contrib/minizip)
include_directories(${MIN_SRC} ${ZLIB_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR})
set(SRC
${MIN_SRC}/ioapi.c
${MIN_SRC}/unzip.c
${MIN_SRC}/zip.c
2017-07-24 02:46:49 +08:00
${MIN_SRC}/unzip.c
2017-07-24 01:57:20 +08:00
${MIN_SRC}/mztools.c
2017-07-22 13:00:32 +08:00
)
if(WIN32)
list(APPEND SRC ${MIN_SRC}/iowin32.c)
endif()
2017-07-22 13:00:32 +08:00
set(HEADERS
2017-07-26 07:50:25 +08:00
${MIN_SRC}/crypt.h
2017-07-22 13:00:32 +08:00
${MIN_SRC}/ioapi.h
${MIN_SRC}/unzip.h
${MIN_SRC}/zip.h
2017-07-24 02:46:49 +08:00
${MIN_SRC}/unzip.h
2017-07-24 01:57:20 +08:00
${MIN_SRC}/mztools.h
2017-07-22 13:00:32 +08:00
)
if(WIN32)
list(APPEND HEADERS ${MIN_SRC}/iowin32.h)
endif()
2017-07-22 13:00:32 +08:00
if(BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
add_library(minizip ${SRC})
target_link_libraries(minizip PRIVATE ZLIB::ZLIB)
target_compile_definitions(minizip PRIVATE -D_ZLIB_H)
target_link_libraries(minizip PRIVATE ${BZIP2_LIBRARIES})
target_compile_definitions(minizip PRIVATE -DHAVE_BZIP2=1)
2017-07-24 02:46:49 +08:00
add_executable(minizip_bin ${MIN_SRC}/minizip.c)
add_executable(miniunz_bin ${MIN_SRC}/miniunz.c)
target_link_libraries(minizip_bin minizip ${BZIP2_LIBRARIES} ZLIB::ZLIB)
target_link_libraries(miniunz_bin minizip ${BZIP2_LIBRARIES} ZLIB::ZLIB)
set_target_properties(minizip_bin PROPERTIES OUTPUT_NAME minizip)
set_target_properties(miniunz_bin PROPERTIES OUTPUT_NAME miniunz)
2017-07-22 13:00:32 +08:00
install(
TARGETS minizip
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
2017-07-24 02:46:49 +08:00
if(NOT DISABLE_INSTALL_TOOLS)
install (
TARGETS minizip_bin miniunz_bin
RUNTIME DESTINATION tools/minizip
)
endif()
2017-07-22 13:00:32 +08:00
if(NOT DISABLE_INSTALL_HEADERS)
install(FILES ${HEADERS} DESTINATION include/minizip)
endif()