2013-07-30 18:02:55 +03:00
|
|
|
project(minizip)
|
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
|
|
|
include_directories(${ZLIB_INCLUDE_DIR})
|
|
|
|
|
|
|
|
#NOTE: full library consists from several more files
|
|
|
|
# but right now VCMI does not need any extra functionality
|
|
|
|
set(lib_SRCS
|
|
|
|
unzip.c
|
2013-07-31 14:36:42 +03:00
|
|
|
zip.c
|
2013-07-30 18:02:55 +03:00
|
|
|
ioapi.c
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(minizip SHARED ${lib_SRCS})
|
2014-10-12 16:41:05 +03:00
|
|
|
if(MSVC)
|
|
|
|
set_target_properties(minizip PROPERTIES COMPILE_DEFINITIONS "MINIZIP_DLL;ZLIB_DLL;ZLIB_INTERNAL")
|
|
|
|
elseif(APPLE)
|
|
|
|
set_target_properties(minizip PROPERTIES XCODE_ATTRIBUTE_LD_DYLIB_INSTALL_NAME "@rpath/libminizip.dylib")
|
|
|
|
endif()
|
|
|
|
|
2017-07-06 22:23:08 +02:00
|
|
|
# multi-config builds (e.g. msvc)
|
|
|
|
foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
|
|
|
|
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIGUPPERCASE)
|
|
|
|
set_target_properties(minizip PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/${OUTPUTCONFIG}/lib)
|
|
|
|
set_target_properties(minizip PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/${OUTPUTCONFIG}/lib)
|
|
|
|
set_target_properties(minizip PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/${OUTPUTCONFIG}/lib)
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# generic no-config case (e.g. with mingw)
|
|
|
|
set_target_properties(minizip PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/lib)
|
|
|
|
set_target_properties(minizip PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/lib)
|
|
|
|
set_target_properties(minizip PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/lib)
|
|
|
|
|
2013-07-30 18:02:55 +03:00
|
|
|
target_link_libraries(minizip ${ZLIB_LIBRARIES})
|
|
|
|
|
2013-10-07 04:19:02 +03:00
|
|
|
if (NOT APPLE) # Already inside vcmiclient bundle
|
2014-07-11 17:27:50 +03:00
|
|
|
install(TARGETS minizip RUNTIME DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR})
|
2013-10-07 04:19:02 +03:00
|
|
|
endif()
|