1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
|
INCLUDE(CheckFunctionExists)
INSTALL(FILES zip.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
SET(CMAKE_C_VISIBILITY_PRESET hidden)
# from http://www.cmake.org/Wiki/CMakeMacroLibtoolFile
MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_value)
GET_TARGET_PROPERTY(${_variable} ${_target} ${_property})
IF(${_variable} STREQUAL NOTFOUND)
SET(${_variable} ${_default_value})
ENDIF()
ENDMACRO()
MACRO(CREATE_LIBTOOL_FILE _target _install_DIR)
GET_TARGET_PROPERTY(_target_location ${_target} LOCATION)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_static_lib ${_target} STATIC_LIB "")
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dependency_libs ${_target} LT_DEPENDENCY_LIBS "")
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_current ${_target} LT_VERSION_CURRENT 4)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_revision ${_target} LT_VERSION_REVISION 0)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_age ${_target} LT_VERSION_AGE 0)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_installed ${_target} LT_INSTALLED yes)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_shouldnotlink ${_target} LT_SHOULDNOTLINK yes)
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlopen ${_target} LT_DLOPEN "")
GET_TARGET_PROPERTY_WITH_DEFAULT(_target_dlpreopen ${_target} LT_DLPREOPEN "")
GET_FILENAME_COMPONENT(_laname ${_target_location} NAME_WE)
GET_FILENAME_COMPONENT(_soname ${_target_location} NAME)
SET(_laname ${_laname}.la)
FILE(WRITE ${_laname} "# ${_laname} - a libtool library file, generated by cmake \n")
FILE(APPEND ${_laname} "# The name that we can dlopen(3).\n")
FILE(APPEND ${_laname} "dlname='${_soname}'\n")
FILE(APPEND ${_laname} "# Names of this library\n")
FILE(APPEND ${_laname} "library_names='${_soname}.${_target_current}.${_target_age}.${_target_revision} ${_soname}.${_target_current} ${_soname}'\n")
FILE(APPEND ${_laname} "# The name of the static archive\n")
FILE(APPEND ${_laname} "old_library='${_target_static_lib}'\n")
FILE(APPEND ${_laname} "# Libraries that this one depends upon.\n")
FILE(APPEND ${_laname} "dependency_libs='${_target_dependency_libs}'\n")
FILE(APPEND ${_laname} "# Version information.\n")
FILE(APPEND ${_laname} "current=${_target_current}\n")
FILE(APPEND ${_laname} "age=${_target_age}\n")
FILE(APPEND ${_laname} "revision=${_target_revision}\n")
FILE(APPEND ${_laname} "# Is this an already installed library?\n")
FILE(APPEND ${_laname} "installed=${_target_installed}\n")
FILE(APPEND ${_laname} "# Should we warn about portability when linking against -modules?\n")
FILE(APPEND ${_laname} "shouldnotlink=${_target_shouldnotlink}\n")
FILE(APPEND ${_laname} "# Files to dlopen/dlpreopen\n")
FILE(APPEND ${_laname} "dlopen='${_target_dlopen}'\n")
FILE(APPEND ${_laname} "dlpreopen='${_target_dlpreopen}'\n")
FILE(APPEND ${_laname} "# Directory that this library needs to be installed in:\n")
FILE(APPEND ${_laname} "libdir='${CMAKE_INSTALL_PREFIX}/${_install_DIR}'\n")
INSTALL( FILES ${_laname} ${_soname} DESTINATION ${CMAKE_INSTALL_PREFIX}${_install_DIR})
ENDMACRO()
SET(LIBZIP_SOURCES
zip_add.c
zip_add_dir.c
zip_add_entry.c
zip_algorithm_deflate.c
zip_buffer.c
zip_close.c
zip_delete.c
zip_dir_add.c
zip_dirent.c
zip_discard.c
zip_entry.c
zip_err_str.c
zip_error.c
zip_error_clear.c
zip_error_get.c
zip_error_get_sys_type.c
zip_error_strerror.c
zip_error_to_str.c
zip_extra_field.c
zip_extra_field_api.c
zip_fclose.c
zip_fdopen.c
zip_file_add.c
zip_file_error_clear.c
zip_file_error_get.c
zip_file_get_comment.c
zip_file_get_external_attributes.c
zip_file_get_offset.c
zip_file_rename.c
zip_file_replace.c
zip_file_set_comment.c
zip_file_set_encryption.c
zip_file_set_external_attributes.c
zip_file_set_mtime.c
zip_file_strerror.c
zip_filerange_crc.c
zip_fopen.c
zip_fopen_encrypted.c
zip_fopen_index.c
zip_fopen_index_encrypted.c
zip_fread.c
zip_fseek.c
zip_ftell.c
zip_get_archive_comment.c
zip_get_archive_flag.c
zip_get_encryption_implementation.c
zip_get_file_comment.c
zip_get_name.c
zip_get_num_entries.c
zip_get_num_files.c
zip_hash.c
zip_io_util.c
zip_libzip_version.c
zip_memdup.c
zip_name_locate.c
zip_new.c
zip_open.c
zip_progress.c
zip_rename.c
zip_replace.c
zip_set_archive_comment.c
zip_set_archive_flag.c
zip_set_default_password.c
zip_set_file_comment.c
zip_set_file_compression.c
zip_set_name.c
zip_source_accept_empty.c
zip_source_begin_write.c
zip_source_begin_write_cloning.c
zip_source_buffer.c
zip_source_call.c
zip_source_close.c
zip_source_commit_write.c
zip_source_compress.c
zip_source_crc.c
zip_source_error.c
zip_source_filep.c
zip_source_free.c
zip_source_function.c
zip_source_get_compression_flags.c
zip_source_is_deleted.c
zip_source_layered.c
zip_source_open.c
zip_source_pkware.c
zip_source_read.c
zip_source_remove.c
zip_source_rollback_write.c
zip_source_seek.c
zip_source_seek_write.c
zip_source_set_mtime.c
zip_source_stat.c
zip_source_supports.c
zip_source_tell.c
zip_source_tell_write.c
zip_source_window.c
zip_source_write.c
zip_source_zip.c
zip_source_zip_new.c
zip_stat.c
zip_stat_index.c
zip_stat_init.c
zip_strerror.c
zip_string.c
zip_unchange.c
zip_unchange_all.c
zip_unchange_archive.c
zip_unchange_data.c
zip_utf-8.c
)
IF(WIN32)
SET(LIBZIP_OPSYS_FILES
zip_source_win32handle.c
zip_source_win32utf8.c
zip_source_win32w.c
)
IF(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
ELSE()
SET(LIBZIP_OPSYS_FILES "${LIBZIP_OPSYS_FILES}"
zip_source_win32a.c
)
ENDIF()
ELSE(WIN32)
SET(LIBZIP_OPSYS_FILES
zip_mkstempm.c
zip_source_file.c
zip_random_unix.c
)
ENDIF(WIN32)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/..)
ADD_CUSTOM_TARGET(update_zip_err_str
COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/make_zip_err_str.sh ${CMAKE_CURRENT_SOURCE_DIR}/zip.h ${CMAKE_CURRENT_SOURCE_DIR}/zip_err_str.c
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/zip.h ${CMAKE_CURRENT_SOURCE_DIR}/make_zip_err_str.sh
)
IF(HAVE_LIBBZ2)
SET(LIBZIP_OPTIONAL_FILES zip_algorithm_bzip2.c)
ENDIF()
IF(HAVE_LIBLZMA)
SET(LIBZIP_OPTIONAL_FILES ${LIBZIP_OPTIONAL_FILES} zip_algorithm_xz.c)
ENDIF()
IF(HAVE_COMMONCRYPTO)
SET(LIBZIP_OPTIONAL_FILES ${LIBZIP_OPTIONAL_FILES} zip_crypto_commoncrypto.c
)
ELSEIF(HAVE_WINDOWS_CRYPTO)
SET(LIBZIP_OPTIONAL_FILES ${LIBZIP_OPTIONAL_FILES} zip_crypto_win.c
)
ELSEIF(HAVE_GNUTLS)
SET(LIBZIP_OPTIONAL_FILES ${LIBZIP_OPTIONAL_FILES} zip_crypto_gnutls.c
)
ELSEIF(HAVE_OPENSSL)
SET(LIBZIP_OPTIONAL_FILES ${LIBZIP_OPTIONAL_FILES} zip_crypto_openssl.c
)
ELSEIF(HAVE_MBEDTLS)
SET(LIBZIP_OPTIONAL_FILES ${LIBZIP_OPTIONAL_FILES} zip_crypto_mbedtls.c
)
ENDIF()
IF(HAVE_CRYPTO)
SET(LIBZIP_OPTIONAL_FILES ${LIBZIP_OPTIONAL_FILES} zip_winzip_aes.c zip_source_winzip_aes_decode.c zip_source_winzip_aes_encode.c
)
ENDIF()
ADD_LIBRARY(zip ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES} ${LIBZIP_OPTIONAL_FILES} ${LIBZIP_OPSYS_FILES})
IF(SHARED_LIB_VERSIONNING)
SET_TARGET_PROPERTIES(zip PROPERTIES VERSION 5.0 SOVERSION 5)
ENDIF()
TARGET_LINK_LIBRARIES(zip PRIVATE ${ZLIB_LIBRARIES} ${OPTIONAL_LIBRARY})
INSTALL(TARGETS zip
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
#CREATE_LIBTOOL_FILE(zip lib)
|