view libzip/lib/CMakeLists.txt @ 4:2306f4b04790

libzip: import 1.1.2
author David Demelier <markand@malikania.fr>
date Wed, 24 Feb 2016 21:19:28 +0100
parents
children
line wrap: on
line source

#
# CMakeLists.txt -- CMake build system for libzip
#
# Copyright (c) 2016 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

set(
	LIBZIP_SOURCES
	zip_add.c
	zip_add_dir.c
	zip_add_entry.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_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_get_archive_comment.c
	zip_get_archive_flag.c
	zip_get_compression_implementation.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_memdup.c
	zip_name_locate.c
	zip_new.c
	zip_open.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_begin_write.c
	zip_source_buffer.c
	zip_source_call.c
	zip_source_close.c
	zip_source_commit_write.c
	zip_source_crc.c
	zip_source_deflate.c
	zip_source_error.c
	zip_source_filep.c
	zip_source_free.c
	zip_source_function.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_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_win32a.c
		zip_source_win32handle.c
		zip_source_win32utf8.c
		zip_source_win32w.c
	)
else ()
	set(LIBZIP_OPSYS_FILES zip_source_file.c)
endif ()

check_function_exists(mkstemp HAVE_MKSTEMP)

if (NOT HAVE_MKSTEMP)
	set(LIBZIP_EXTRA_FILES mkstemp.c)
endif ()

add_library(zip STATIC ${LIBZIP_SOURCES} ${LIBZIP_EXTRA_FILES} ${LIBZIP_OPSYS_FILES})
target_link_libraries(zip ${ZLIB_LIBRARY})
target_compile_definitions(zip PRIVATE HAVE_CONFIG_H)
target_include_directories(
	zip
	PUBLIC ${ZLIB_INCLUDE_DIRS}
	PRIVATE ${libzip_BINARY_DIR}
)

if (MSVC)
	target_compile_definitions(zip PUBLIC _CRT_SECURE_NO_WARNINGS)
endif ()