mirror of
https://github.com/madler/zlib
synced 2025-03-28 21:13:15 +00:00
CMake: Add cmake-format.yaml and reformat the cmake files.
This commit is contained in:
parent
4f2671d50c
commit
8b8a124eb4
245
.cmake-format.yaml
Normal file
245
.cmake-format.yaml
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
_help_parse: Options affecting listfile parsing
|
||||||
|
parse:
|
||||||
|
_help_additional_commands:
|
||||||
|
- Specify structure for custom cmake functions
|
||||||
|
additional_commands:
|
||||||
|
foo:
|
||||||
|
flags:
|
||||||
|
- BAR
|
||||||
|
- BAZ
|
||||||
|
kwargs:
|
||||||
|
HEADERS: '*'
|
||||||
|
SOURCES: '*'
|
||||||
|
DEPENDS: '*'
|
||||||
|
_help_override_spec:
|
||||||
|
- Override configurations per-command where available
|
||||||
|
override_spec: {}
|
||||||
|
_help_vartags:
|
||||||
|
- Specify variable tags.
|
||||||
|
vartags: []
|
||||||
|
_help_proptags:
|
||||||
|
- Specify property tags.
|
||||||
|
proptags: []
|
||||||
|
_help_format: Options affecting formatting.
|
||||||
|
format:
|
||||||
|
_help_disable:
|
||||||
|
- Disable formatting entirely, making cmake-format a no-op
|
||||||
|
disable: false
|
||||||
|
_help_line_width:
|
||||||
|
- How wide to allow formatted cmake files
|
||||||
|
line_width: 80
|
||||||
|
_help_tab_size:
|
||||||
|
- How many spaces to tab for indent
|
||||||
|
tab_size: 4
|
||||||
|
_help_use_tabchars:
|
||||||
|
- If true, lines are indented using tab characters (utf-8
|
||||||
|
- 0x09) instead of <tab_size> space characters (utf-8 0x20).
|
||||||
|
- In cases where the layout would require a fractional tab
|
||||||
|
- character, the behavior of the fractional indentation is
|
||||||
|
- governed by <fractional_tab_policy>
|
||||||
|
use_tabchars: false
|
||||||
|
_help_fractional_tab_policy:
|
||||||
|
- If <use_tabchars> is True, then the value of this variable
|
||||||
|
- indicates how fractional indentions are handled during
|
||||||
|
- whitespace replacement. If set to 'use-space', fractional
|
||||||
|
- indentation is left as spaces (utf-8 0x20). If set to
|
||||||
|
- '`round-up` fractional indentation is replaced with a single'
|
||||||
|
- tab character (utf-8 0x09) effectively shifting the column
|
||||||
|
- to the next tabstop
|
||||||
|
fractional_tab_policy: use-space
|
||||||
|
_help_max_subgroups_hwrap:
|
||||||
|
- If an argument group contains more than this many sub-groups
|
||||||
|
- (parg or kwarg groups) then force it to a vertical layout.
|
||||||
|
max_subgroups_hwrap: 2
|
||||||
|
_help_max_pargs_hwrap:
|
||||||
|
- If a positional argument group contains more than this many
|
||||||
|
- arguments, then force it to a vertical layout.
|
||||||
|
max_pargs_hwrap: 6
|
||||||
|
_help_max_rows_cmdline:
|
||||||
|
- If a cmdline positional group consumes more than this many
|
||||||
|
- lines without nesting, then invalidate the layout (and nest)
|
||||||
|
max_rows_cmdline: 2
|
||||||
|
_help_separate_ctrl_name_with_space:
|
||||||
|
- If true, separate flow control names from their parentheses
|
||||||
|
- with a space
|
||||||
|
separate_ctrl_name_with_space: false
|
||||||
|
_help_separate_fn_name_with_space:
|
||||||
|
- If true, separate function names from parentheses with a
|
||||||
|
- space
|
||||||
|
separate_fn_name_with_space: false
|
||||||
|
_help_dangle_parens:
|
||||||
|
- If a statement is wrapped to more than one line, than dangle
|
||||||
|
- the closing parenthesis on its own line.
|
||||||
|
dangle_parens: false
|
||||||
|
_help_dangle_align:
|
||||||
|
- If the trailing parenthesis must be 'dangled' on its on
|
||||||
|
- 'line, then align it to this reference: `prefix`: the start'
|
||||||
|
- 'of the statement, `prefix-indent`: the start of the'
|
||||||
|
- 'statement, plus one indentation level, `child`: align to'
|
||||||
|
- the column of the arguments
|
||||||
|
dangle_align: prefix
|
||||||
|
_help_min_prefix_chars:
|
||||||
|
- If the statement spelling length (including space and
|
||||||
|
- parenthesis) is smaller than this amount, then force reject
|
||||||
|
- nested layouts.
|
||||||
|
min_prefix_chars: 4
|
||||||
|
_help_max_prefix_chars:
|
||||||
|
- If the statement spelling length (including space and
|
||||||
|
- parenthesis) is larger than the tab width by more than this
|
||||||
|
- amount, then force reject un-nested layouts.
|
||||||
|
max_prefix_chars: 10
|
||||||
|
_help_max_lines_hwrap:
|
||||||
|
- If a candidate layout is wrapped horizontally but it exceeds
|
||||||
|
- this many lines, then reject the layout.
|
||||||
|
max_lines_hwrap: 2
|
||||||
|
_help_line_ending:
|
||||||
|
- What style line endings to use in the output.
|
||||||
|
line_ending: unix
|
||||||
|
_help_command_case:
|
||||||
|
- Format command names consistently as 'lower' or 'upper' case
|
||||||
|
command_case: canonical
|
||||||
|
_help_keyword_case:
|
||||||
|
- Format keywords consistently as 'lower' or 'upper' case
|
||||||
|
keyword_case: unchanged
|
||||||
|
_help_always_wrap:
|
||||||
|
- A list of command names which should always be wrapped
|
||||||
|
always_wrap: []
|
||||||
|
_help_enable_sort:
|
||||||
|
- If true, the argument lists which are known to be sortable
|
||||||
|
- will be sorted lexicographicall
|
||||||
|
enable_sort: true
|
||||||
|
_help_autosort:
|
||||||
|
- If true, the parsers may infer whether or not an argument
|
||||||
|
- list is sortable (without annotation).
|
||||||
|
autosort: false
|
||||||
|
_help_require_valid_layout:
|
||||||
|
- By default, if cmake-format cannot successfully fit
|
||||||
|
- everything into the desired linewidth it will apply the
|
||||||
|
- last, most aggressive attempt that it made. If this flag is
|
||||||
|
- True, however, cmake-format will print error, exit with non-
|
||||||
|
- zero status code, and write-out nothing
|
||||||
|
require_valid_layout: false
|
||||||
|
_help_layout_passes:
|
||||||
|
- A dictionary mapping layout nodes to a list of wrap
|
||||||
|
- decisions. See the documentation for more information.
|
||||||
|
layout_passes: {}
|
||||||
|
_help_markup: Options affecting comment reflow and formatting.
|
||||||
|
markup:
|
||||||
|
_help_bullet_char:
|
||||||
|
- What character to use for bulleted lists
|
||||||
|
bullet_char: '*'
|
||||||
|
_help_enum_char:
|
||||||
|
- What character to use as punctuation after numerals in an
|
||||||
|
- enumerated list
|
||||||
|
enum_char: .
|
||||||
|
_help_first_comment_is_literal:
|
||||||
|
- If comment markup is enabled, don't reflow the first comment
|
||||||
|
- block in each listfile. Use this to preserve formatting of
|
||||||
|
- your copyright/license statements.
|
||||||
|
first_comment_is_literal: false
|
||||||
|
_help_literal_comment_pattern:
|
||||||
|
- If comment markup is enabled, don't reflow any comment block
|
||||||
|
- which matches this (regex) pattern. Default is `None`
|
||||||
|
- (disabled).
|
||||||
|
literal_comment_pattern: null
|
||||||
|
_help_fence_pattern:
|
||||||
|
- Regular expression to match preformat fences in comments
|
||||||
|
- default= ``r'^\s*([`~]{3}[`~]*)(.*)$'``
|
||||||
|
fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$
|
||||||
|
_help_ruler_pattern:
|
||||||
|
- Regular expression to match rulers in comments default=
|
||||||
|
- '``r''^\s*[^\w\s]{3}.*[^\w\s]{3}$''``'
|
||||||
|
ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$
|
||||||
|
_help_explicit_trailing_pattern:
|
||||||
|
- If a comment line matches starts with this pattern then it
|
||||||
|
- is explicitly a trailing comment for the preceding argument.
|
||||||
|
- Default is '#<'
|
||||||
|
explicit_trailing_pattern: '#<'
|
||||||
|
_help_hashruler_min_length:
|
||||||
|
- If a comment line starts with at least this many consecutive
|
||||||
|
- hash characters, then don't lstrip() them off. This allows
|
||||||
|
- for lazy hash rulers where the first hash char is not
|
||||||
|
- separated by space
|
||||||
|
hashruler_min_length: 10
|
||||||
|
_help_canonicalize_hashrulers:
|
||||||
|
- If true, then insert a space between the first hash char and
|
||||||
|
- remaining hash chars in a hash ruler, and normalize its
|
||||||
|
- length to fill the column
|
||||||
|
canonicalize_hashrulers: true
|
||||||
|
_help_enable_markup:
|
||||||
|
- enable comment markup parsing and reflow
|
||||||
|
enable_markup: true
|
||||||
|
_help_lint: Options affecting the linter
|
||||||
|
lint:
|
||||||
|
_help_disabled_codes:
|
||||||
|
- a list of lint codes to disable
|
||||||
|
disabled_codes: []
|
||||||
|
_help_function_pattern:
|
||||||
|
- regular expression pattern describing valid function names
|
||||||
|
function_pattern: '[0-9a-z_]+'
|
||||||
|
_help_macro_pattern:
|
||||||
|
- regular expression pattern describing valid macro names
|
||||||
|
macro_pattern: '[0-9A-Z_]+'
|
||||||
|
_help_global_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- variables with global (cache) scope
|
||||||
|
global_var_pattern: '[A-Z][0-9A-Z_]+'
|
||||||
|
_help_internal_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- variables with global scope (but internal semantic)
|
||||||
|
internal_var_pattern: _[A-Z][0-9A-Z_]+
|
||||||
|
_help_local_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- variables with local scope
|
||||||
|
local_var_pattern: '[a-z][a-z0-9_]+'
|
||||||
|
_help_private_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- privatedirectory variables
|
||||||
|
private_var_pattern: _[0-9a-z_]+
|
||||||
|
_help_public_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for public
|
||||||
|
- directory variables
|
||||||
|
public_var_pattern: '[A-Z][0-9A-Z_]+'
|
||||||
|
_help_argument_var_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- function/macro arguments and loop variables.
|
||||||
|
argument_var_pattern: '[a-z][a-z0-9_]+'
|
||||||
|
_help_keyword_pattern:
|
||||||
|
- regular expression pattern describing valid names for
|
||||||
|
- keywords used in functions or macros
|
||||||
|
keyword_pattern: '[A-Z][0-9A-Z_]+'
|
||||||
|
_help_max_conditionals_custom_parser:
|
||||||
|
- In the heuristic for C0201, how many conditionals to match
|
||||||
|
- within a loop in before considering the loop a parser.
|
||||||
|
max_conditionals_custom_parser: 2
|
||||||
|
_help_min_statement_spacing:
|
||||||
|
- Require at least this many newlines between statements
|
||||||
|
min_statement_spacing: 1
|
||||||
|
_help_max_statement_spacing:
|
||||||
|
- Require no more than this many newlines between statements
|
||||||
|
max_statement_spacing: 2
|
||||||
|
max_returns: 6
|
||||||
|
max_branches: 12
|
||||||
|
max_arguments: 5
|
||||||
|
max_localvars: 15
|
||||||
|
max_statements: 50
|
||||||
|
_help_encode: Options affecting file encoding
|
||||||
|
encode:
|
||||||
|
_help_emit_byteorder_mark:
|
||||||
|
- If true, emit the unicode byte-order mark (BOM) at the start
|
||||||
|
- of the file
|
||||||
|
emit_byteorder_mark: false
|
||||||
|
_help_input_encoding:
|
||||||
|
- Specify the encoding of the input file. Defaults to utf-8
|
||||||
|
input_encoding: utf-8
|
||||||
|
_help_output_encoding:
|
||||||
|
- Specify the encoding of the output file. Defaults to utf-8.
|
||||||
|
- Note that cmake only claims to support utf-8 so be careful
|
||||||
|
- when using anything else
|
||||||
|
output_encoding: utf-8
|
||||||
|
_help_misc: Miscellaneous configurations options.
|
||||||
|
misc:
|
||||||
|
_help_per_command:
|
||||||
|
- A dictionary containing any per-command configuration
|
||||||
|
- overrides. Currently only `command_case` is supported.
|
||||||
|
per_command: {}
|
154
CMakeLists.txt
154
CMakeLists.txt
@ -1,30 +1,30 @@
|
|||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
project(zlib
|
project(
|
||||||
|
zlib
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
VERSION 1.3.1.1
|
VERSION 1.4.1.1
|
||||||
HOMEPAGE_URL "https://zlib.net/"
|
HOMEPAGE_URL "https://zlib.net/"
|
||||||
DESCRIPTION "a general-purpose lossless data-compression library")
|
DESCRIPTION "a general-purpose lossless data-compression library")
|
||||||
|
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
# CPack
|
# CPack
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
set(CPACK_PACKAGE_VENDOR "zlib-Project")
|
set(CPACK_PACKAGE_VENDOR "zlib-Project")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE ${zlib_SOURCE_DIR}/README)
|
set(CPACK_PACKAGE_DESCRIPTION_FILE ${zlib_SOURCE_DIR}/README)
|
||||||
set(CPACK_RESOURCE_FILE_LICENSE ${zlib_SOURCE_DIR}/LICENSE)
|
set(CPACK_RESOURCE_FILE_LICENSE ${zlib_SOURCE_DIR}/LICENSE)
|
||||||
set(CPACK_RESOURCE_FILE_README ${zlib_SOURCE_DIR}/README)
|
set(CPACK_RESOURCE_FILE_README ${zlib_SOURCE_DIR}/README)
|
||||||
|
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
# configuration
|
# configuration
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
option(ZLIB_BUILD_TESTING "Enable Zlib Examples as tests" ON)
|
option(ZLIB_BUILD_TESTING "Enable Zlib Examples as tests" ON)
|
||||||
option(ZLIB_BUILD_SHARED "Enable building zlib shared library" ON)
|
option(ZLIB_BUILD_SHARED "Enable building zlib shared library" ON)
|
||||||
option(ZLIB_BUILD_STATIC "Enable building zlib static library" ON)
|
option(ZLIB_BUILD_STATIC "Enable building zlib static library" ON)
|
||||||
option(ZLIB_BUILD_MINIZIP "Enable building libminizip contrib library" OFF)
|
option(ZLIB_BUILD_MINIZIP "Enable building libminizip contrib library" OFF)
|
||||||
option(ZLIB_INSTALL "Enable installation of zlib" ON)
|
option(ZLIB_INSTALL "Enable installation of zlib" ON)
|
||||||
option(ZLIB_PREFIX
|
option(ZLIB_PREFIX "prefix for all types and library functions, see zconf.h.in"
|
||||||
"prefix for all types and library functions, see zconf.h.in"
|
|
||||||
OFF)
|
OFF)
|
||||||
mark_as_advanced(ZLIB_PREFIX)
|
mark_as_advanced(ZLIB_PREFIX)
|
||||||
|
|
||||||
@ -70,7 +70,9 @@ if(NOT ZLIB_CONF_WRITTEN)
|
|||||||
endforeach(item IN LISTS ${ZCONF_CONTENT})
|
endforeach(item IN LISTS ${ZCONF_CONTENT})
|
||||||
|
|
||||||
file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT})
|
file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT})
|
||||||
set(ZLIB_CONF_WRITTEN TRUE CACHE BOOL "zconf.h.cmakein was created")
|
set(ZLIB_CONF_WRITTEN
|
||||||
|
TRUE
|
||||||
|
CACHE BOOL "zconf.h.cmakein was created")
|
||||||
mark_as_advanced(ZLIB_CONF_WRITTEN)
|
mark_as_advanced(ZLIB_CONF_WRITTEN)
|
||||||
endif(NOT ZLIB_CONF_WRITTEN)
|
endif(NOT ZLIB_CONF_WRITTEN)
|
||||||
|
|
||||||
@ -115,19 +117,15 @@ check_c_source_compiles(
|
|||||||
|
|
||||||
unset(CMAKE_COMPILE_FLAGS)
|
unset(CMAKE_COMPILE_FLAGS)
|
||||||
set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc)
|
set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc)
|
||||||
configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein
|
configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY)
|
||||||
${ZLIB_PC} @ONLY)
|
configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein ${zlib_BINARY_DIR}/zconf.h)
|
||||||
configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein
|
|
||||||
${zlib_BINARY_DIR}/zconf.h)
|
|
||||||
include_directories(${zlib_BINARY_DIR} ${zlib_SOURCE_DIR})
|
include_directories(${zlib_BINARY_DIR} ${zlib_SOURCE_DIR})
|
||||||
|
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
# zlib
|
# zlib
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
set(ZLIB_PUBLIC_HDRS
|
set(ZLIB_PUBLIC_HDRS ${zlib_BINARY_DIR}/zconf.h zlib.h)
|
||||||
${zlib_BINARY_DIR}/zconf.h
|
|
||||||
zlib.h)
|
|
||||||
|
|
||||||
set(ZLIB_PRIVATE_HDRS
|
set(ZLIB_PRIVATE_HDRS
|
||||||
crc32.h
|
crc32.h
|
||||||
@ -157,8 +155,10 @@ set(ZLIB_SRCS
|
|||||||
uncompr.c
|
uncompr.c
|
||||||
zutil.c)
|
zutil.c)
|
||||||
|
|
||||||
set_source_files_properties(win32/zlib1.rc PROPERTIES
|
set_source_files_properties(
|
||||||
COMPILE_FLAGS $<$<STREQUAL:${CMAKE_RC_OUTPUT_EXTENSION},.obj>:-DGCC_WINDRES>)
|
win32/zlib1.rc
|
||||||
|
PROPERTIES COMPILE_FLAGS
|
||||||
|
$<$<STREQUAL:${CMAKE_RC_OUTPUT_EXTENSION},.obj>:-DGCC_WINDRES>)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(zlib_static_suffix "s")
|
set(zlib_static_suffix "s")
|
||||||
@ -166,116 +166,126 @@ if(WIN32)
|
|||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
if(ZLIB_BUILD_SHARED)
|
if(ZLIB_BUILD_SHARED)
|
||||||
add_library(zlib SHARED
|
add_library(
|
||||||
${ZLIB_SRCS}
|
zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}
|
||||||
${ZLIB_PUBLIC_HDRS}
|
|
||||||
${ZLIB_PRIVATE_HDRS}
|
|
||||||
$<$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>:win32/zlib1.rc>)
|
$<$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>:win32/zlib1.rc>)
|
||||||
add_library(ZLIB::ZLIB ALIAS zlib)
|
add_library(ZLIB::ZLIB ALIAS zlib)
|
||||||
target_include_directories(zlib PUBLIC
|
target_include_directories(
|
||||||
$<BUILD_INTERFACE:${zlib_BINARY_DIR}>
|
zlib
|
||||||
|
PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}>
|
||||||
$<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
target_compile_definitions(zlib
|
target_compile_definitions(
|
||||||
PRIVATE
|
zlib
|
||||||
$<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
|
PRIVATE $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
|
||||||
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
|
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
|
||||||
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
|
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
|
||||||
$<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
|
$<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
|
||||||
PUBLIC
|
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
|
||||||
$<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
|
|
||||||
set(INSTALL_VERSION ${zlib_VERSION})
|
set(INSTALL_VERSION ${zlib_VERSION})
|
||||||
|
|
||||||
if(NOT CYGWIN)
|
if(NOT CYGWIN)
|
||||||
set_target_properties(zlib PROPERTIES
|
set_target_properties(zlib PROPERTIES SOVERSION ${zlib_VERSION_MAJOR}
|
||||||
SOVERSION ${zlib_VERSION_MAJOR}
|
|
||||||
VERSION ${INSTALL_VERSION})
|
VERSION ${INSTALL_VERSION})
|
||||||
endif(NOT CYGWIN)
|
endif(NOT CYGWIN)
|
||||||
|
|
||||||
set_target_properties(zlib PROPERTIES
|
set_target_properties(
|
||||||
DEFINE_SYMBOL ZLIB_DLL
|
zlib
|
||||||
|
PROPERTIES DEFINE_SYMBOL ZLIB_DLL
|
||||||
EXPORT_NAME ZLIB
|
EXPORT_NAME ZLIB
|
||||||
OUTPUT_NAME z)
|
OUTPUT_NAME z)
|
||||||
if(UNIX AND NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX))
|
if(UNIX
|
||||||
|
AND NOT APPLE
|
||||||
|
AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX))
|
||||||
# On unix-like platforms the library is almost always called libz
|
# On unix-like platforms the library is almost always called libz
|
||||||
set_target_properties(zlib PROPERTIES
|
set_target_properties(
|
||||||
LINK_FLAGS "-Wl,--version-script,\"${zlib_SOURCE_DIR}/zlib.map\"")
|
zlib
|
||||||
endif(UNIX AND NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX))
|
PROPERTIES LINK_FLAGS
|
||||||
|
"-Wl,--version-script,\"${zlib_SOURCE_DIR}/zlib.map\"")
|
||||||
|
endif(
|
||||||
|
UNIX
|
||||||
|
AND NOT APPLE
|
||||||
|
AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX))
|
||||||
endif(ZLIB_BUILD_SHARED)
|
endif(ZLIB_BUILD_SHARED)
|
||||||
|
|
||||||
if(ZLIB_BUILD_STATIC)
|
if(ZLIB_BUILD_STATIC)
|
||||||
add_library(zlibstatic STATIC
|
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS}
|
||||||
${ZLIB_SRCS}
|
|
||||||
${ZLIB_PUBLIC_HDRS}
|
|
||||||
${ZLIB_PRIVATE_HDRS})
|
${ZLIB_PRIVATE_HDRS})
|
||||||
add_library(ZLIB::ZLIBSTATIC ALIAS zlibstatic)
|
add_library(ZLIB::ZLIBSTATIC ALIAS zlibstatic)
|
||||||
target_include_directories(zlibstatic PUBLIC
|
target_include_directories(
|
||||||
$<BUILD_INTERFACE:${zlib_BINARY_DIR}>
|
zlibstatic
|
||||||
|
PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}>
|
||||||
$<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
target_compile_definitions(zlibstatic
|
target_compile_definitions(
|
||||||
PRIVATE
|
zlibstatic
|
||||||
$<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
|
PRIVATE $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
|
||||||
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
|
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
|
||||||
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
|
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
|
||||||
$<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
|
$<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
|
||||||
PUBLIC
|
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
|
||||||
$<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
|
set_target_properties(
|
||||||
set_target_properties(zlibstatic PROPERTIES
|
zlibstatic PROPERTIES EXPORT_NAME ZLIBSTATIC OUTPUT_NAME
|
||||||
EXPORT_NAME ZLIBSTATIC
|
z${zlib_static_suffix})
|
||||||
OUTPUT_NAME z${zlib_static_suffix})
|
|
||||||
endif(ZLIB_BUILD_STATIC)
|
endif(ZLIB_BUILD_STATIC)
|
||||||
|
|
||||||
if(ZLIB_INSTALL)
|
if(ZLIB_INSTALL)
|
||||||
if(ZLIB_BUILD_SHARED)
|
if(ZLIB_BUILD_SHARED)
|
||||||
install(TARGETS zlib
|
install(
|
||||||
|
TARGETS zlib
|
||||||
COMPONENT Runtime
|
COMPONENT Runtime
|
||||||
EXPORT zlibSharedExport
|
EXPORT zlibSharedExport
|
||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
install(EXPORT zlibSharedExport
|
install(
|
||||||
|
EXPORT zlibSharedExport
|
||||||
FILE ZLIB-shared.cmake
|
FILE ZLIB-shared.cmake
|
||||||
NAMESPACE ZLIB::
|
NAMESPACE ZLIB::
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
|
||||||
if(ZLIB_INSTALL_COMPAT_DLL)
|
if(ZLIB_INSTALL_COMPAT_DLL)
|
||||||
install(FILES $<TARGET_FILE:zlib>
|
install(
|
||||||
|
FILES $<TARGET_FILE:zlib>
|
||||||
COMPONENT Runtime
|
COMPONENT Runtime
|
||||||
RENAME zlib1.dll
|
RENAME zlib1.dll
|
||||||
DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
endif(ZLIB_INSTALL_COMPAT_DLL)
|
endif(ZLIB_INSTALL_COMPAT_DLL)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
install(FILES $<TARGET_PDB_FILE:zlib>
|
install(
|
||||||
|
FILES $<TARGET_PDB_FILE:zlib>
|
||||||
COMPONENT Runtime
|
COMPONENT Runtime
|
||||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
CONFIGURATIONS Debug OR RelWithDebInfo
|
CONFIGURATIONS Debug OR RelWithDebInfo
|
||||||
OPTIONAL
|
OPTIONAL)
|
||||||
)
|
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
endif(ZLIB_BUILD_SHARED)
|
endif(ZLIB_BUILD_SHARED)
|
||||||
|
|
||||||
if(ZLIB_BUILD_STATIC)
|
if(ZLIB_BUILD_STATIC)
|
||||||
install(TARGETS zlibstatic
|
install(
|
||||||
|
TARGETS zlibstatic
|
||||||
COMPONENT Development
|
COMPONENT Development
|
||||||
EXPORT zlibStaticExport
|
EXPORT zlibStaticExport
|
||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
install(EXPORT zlibStaticExport
|
install(
|
||||||
|
EXPORT zlibStaticExport
|
||||||
FILE ZLIB-static.cmake
|
FILE ZLIB-static.cmake
|
||||||
NAMESPACE ZLIB::
|
NAMESPACE ZLIB::
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
|
||||||
|
|
||||||
if(ZLIB_INSTALL_COMPAT_DLL AND MINGW)
|
if(ZLIB_INSTALL_COMPAT_DLL AND MINGW)
|
||||||
install(FILES $<TARGET_FILE:zlibstatic>
|
install(
|
||||||
|
FILES $<TARGET_FILE:zlibstatic>
|
||||||
COMPONENT Development
|
COMPONENT Development
|
||||||
RENAME libz.dll.a
|
RENAME libz.dll.a
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
endif(ZLIB_INSTALL_COMPAT_DLL AND MINGW)
|
endif(ZLIB_INSTALL_COMPAT_DLL AND MINGW)
|
||||||
endif(ZLIB_BUILD_STATIC)
|
endif(ZLIB_BUILD_STATIC)
|
||||||
|
|
||||||
configure_package_config_file(${zlib_SOURCE_DIR}/zlibConfig.cmake.in
|
configure_package_config_file(
|
||||||
|
${zlib_SOURCE_DIR}/zlibConfig.cmake.in
|
||||||
${zlib_BINARY_DIR}/ZLIBConfig.cmake
|
${zlib_BINARY_DIR}/ZLIBConfig.cmake
|
||||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
|
||||||
|
|
||||||
@ -284,18 +294,19 @@ if(ZLIB_INSTALL)
|
|||||||
VERSION "${zlib_VERSION}"
|
VERSION "${zlib_VERSION}"
|
||||||
COMPATIBILITY AnyNewerVersion)
|
COMPATIBILITY AnyNewerVersion)
|
||||||
|
|
||||||
install(FILES
|
install(FILES ${zlib_BINARY_DIR}/ZLIBConfig.cmake
|
||||||
${zlib_BINARY_DIR}/ZLIBConfig.cmake
|
|
||||||
${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake
|
${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
|
||||||
install(FILES ${ZLIB_PUBLIC_HDRS}
|
install(
|
||||||
|
FILES ${ZLIB_PUBLIC_HDRS}
|
||||||
COMPONENT Development
|
COMPONENT Development
|
||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
install(FILES zlib.3
|
install(
|
||||||
|
FILES zlib.3
|
||||||
COMPONENT Docs
|
COMPONENT Docs
|
||||||
DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
|
DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
|
||||||
install(FILES
|
install(
|
||||||
LICENSE
|
FILES LICENSE
|
||||||
doc/algorithm.txt
|
doc/algorithm.txt
|
||||||
doc/crc-doc.1.0.pdf
|
doc/crc-doc.1.0.pdf
|
||||||
doc/rfc1950.txt
|
doc/rfc1950.txt
|
||||||
@ -304,14 +315,15 @@ if(ZLIB_INSTALL)
|
|||||||
doc/txtvsbin.txt
|
doc/txtvsbin.txt
|
||||||
COMPONENT Docs
|
COMPONENT Docs
|
||||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib")
|
DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib")
|
||||||
install(FILES ${ZLIB_PC}
|
install(
|
||||||
|
FILES ${ZLIB_PC}
|
||||||
COMPONENT Development
|
COMPONENT Development
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
endif(ZLIB_INSTALL)
|
endif(ZLIB_INSTALL)
|
||||||
|
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
# Tests
|
# Tests
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
if(ZLIB_BUILD_TESTING)
|
if(ZLIB_BUILD_TESTING)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
project(minizip
|
project(
|
||||||
|
minizip
|
||||||
VERSION 1.0.0
|
VERSION 1.0.0
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
DESCRIPTION "A library for creating zipfiles based in zlib"
|
DESCRIPTION "A library for creating zipfiles based in zlib"
|
||||||
@ -11,17 +12,17 @@ if(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW)
|
|||||||
return()
|
return()
|
||||||
endif(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW)
|
endif(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW)
|
||||||
|
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
# CPack
|
# CPack
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
set(CPACK_PACKAGE_VENDOR "zlib-Project")
|
set(CPACK_PACKAGE_VENDOR "zlib-Project")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE ${minizip_SOURCE_DIR}/MiniZip64_info.txt)
|
set(CPACK_PACKAGE_DESCRIPTION_FILE ${minizip_SOURCE_DIR}/MiniZip64_info.txt)
|
||||||
set(CPACK_RESOURCE_FILE_LICENSE ${minizip_SOURCE_DIR}/../../LICENSE)
|
set(CPACK_RESOURCE_FILE_LICENSE ${minizip_SOURCE_DIR}/../../LICENSE)
|
||||||
set(CPACK_RESOURCE_FILE_README ${minizip_SOURCE_DIR}/MiniZip64_info.txt)
|
set(CPACK_RESOURCE_FILE_README ${minizip_SOURCE_DIR}/MiniZip64_info.txt)
|
||||||
|
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
# configuration
|
# configuration
|
||||||
#============================================================================
|
# ============================================================================
|
||||||
option(MINIZIP_BUILD_SHARED "Enable building minizip shared library" ON)
|
option(MINIZIP_BUILD_SHARED "Enable building minizip shared library" ON)
|
||||||
option(MINIZIP_BUILD_STATIC "Enable building minizip static library" ON)
|
option(MINIZIP_BUILD_STATIC "Enable building minizip static library" ON)
|
||||||
option(MINIZIP_BUILD_TESTING "Enable testing of minizip" ON)
|
option(MINIZIP_BUILD_TESTING "Enable testing of minizip" ON)
|
||||||
@ -92,39 +93,16 @@ if(NOT TARGET ZLIB::ZLIB)
|
|||||||
find_package(ZLIB REQUIRED CONFIG)
|
find_package(ZLIB REQUIRED CONFIG)
|
||||||
endif(NOT TARGET ZLIB::ZLIB)
|
endif(NOT TARGET ZLIB::ZLIB)
|
||||||
|
|
||||||
set(LIBMINIZIP_SRCS
|
set(LIBMINIZIP_SRCS ioapi.c mztools.c unzip.c zip.c)
|
||||||
ioapi.c
|
|
||||||
mztools.c
|
|
||||||
unzip.c
|
|
||||||
zip.c)
|
|
||||||
|
|
||||||
set(LIBMINIZIP_HDRS
|
set(LIBMINIZIP_HDRS crypt.h ints.h ioapi.h mztools.h unzip.h zip.h)
|
||||||
crypt.h
|
|
||||||
ints.h
|
set(MINIZIP_SRCS ioapi.c $<$<BOOL:${WIN32}>:iowin32.c> minizip.c zip.c)
|
||||||
ioapi.h
|
|
||||||
mztools.h
|
set(MINIZIP_HDRS crypt.h ints.h ioapi.h $<$<BOOL:${WIN32}>:iowin32.h> skipset.h
|
||||||
unzip.h
|
|
||||||
zip.h)
|
zip.h)
|
||||||
|
|
||||||
set(MINIZIP_SRCS
|
set(MINIUNZIP_SRCS ioapi.c $<$<BOOL:${WIN32}>:iowin32.c> miniunz.c unzip.c
|
||||||
ioapi.c
|
|
||||||
$<$<BOOL:${WIN32}>:iowin32.c>
|
|
||||||
minizip.c
|
|
||||||
zip.c)
|
|
||||||
|
|
||||||
set(MINIZIP_HDRS
|
|
||||||
crypt.h
|
|
||||||
ints.h
|
|
||||||
ioapi.h
|
|
||||||
$<$<BOOL:${WIN32}>:iowin32.h>
|
|
||||||
skipset.h
|
|
||||||
zip.h)
|
|
||||||
|
|
||||||
set(MINIUNZIP_SRCS
|
|
||||||
ioapi.c
|
|
||||||
$<$<BOOL:${WIN32}>:iowin32.c>
|
|
||||||
miniunz.c
|
|
||||||
unzip.c
|
|
||||||
zip.c)
|
zip.c)
|
||||||
|
|
||||||
set(MINIUNZIP_HDRS
|
set(MINIUNZIP_HDRS
|
||||||
@ -143,137 +121,122 @@ endif(WIN32)
|
|||||||
|
|
||||||
if(MINIZIP_BUILD_SHARED)
|
if(MINIZIP_BUILD_SHARED)
|
||||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
||||||
add_library(libminizip SHARED
|
add_library(libminizip SHARED ${LIBMINIZIP_SRCS} ${LIBMINIZIP_HDRS})
|
||||||
${LIBMINIZIP_SRCS}
|
|
||||||
${LIBMINIZIP_HDRS})
|
|
||||||
add_library(MINIZIP::minizip ALIAS libminizip)
|
add_library(MINIZIP::minizip ALIAS libminizip)
|
||||||
target_include_directories(libminizip PUBLIC
|
target_include_directories(
|
||||||
$<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
|
libminizip PUBLIC $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
target_compile_definitions(libminizip
|
target_compile_definitions(
|
||||||
PRIVATE
|
libminizip
|
||||||
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
||||||
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
|
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
|
||||||
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
|
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
|
||||||
$<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
|
$<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
|
||||||
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>
|
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>
|
||||||
PUBLIC
|
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
|
||||||
$<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
|
|
||||||
|
|
||||||
if(NOT CYGWIN)
|
if(NOT CYGWIN)
|
||||||
set_target_properties(libminizip PROPERTIES
|
set_target_properties(libminizip PROPERTIES SOVERSION
|
||||||
SOVERSION ${minizip_VERSION_MAJOR})
|
${minizip_VERSION_MAJOR})
|
||||||
endif(NOT CYGWIN)
|
endif(NOT CYGWIN)
|
||||||
|
|
||||||
set_target_properties(libminizip PROPERTIES
|
set_target_properties(
|
||||||
EXPORT_NAME minizip
|
libminizip
|
||||||
|
PROPERTIES EXPORT_NAME minizip
|
||||||
OUTPUT_NAME minizip
|
OUTPUT_NAME minizip
|
||||||
VERSIOM ${minizip_VERSION}
|
VERSIOM ${minizip_VERSION}
|
||||||
SOVERSION ${minizip_VERSION_MAJOR})
|
SOVERSION ${minizip_VERSION_MAJOR})
|
||||||
target_link_libraries(libminizip PUBLIC ZLIB::ZLIB)
|
target_link_libraries(libminizip PUBLIC ZLIB::ZLIB)
|
||||||
|
|
||||||
add_executable(minizip
|
add_executable(minizip ${MINIZIP_SRCS} ${MINIZIP_HDRS})
|
||||||
${MINIZIP_SRCS}
|
set_target_properties(minizip PROPERTIES EXPORT_NAME minizip_executable)
|
||||||
${MINIZIP_HDRS})
|
target_compile_definitions(
|
||||||
set_target_properties(minizip PROPERTIES
|
minizip PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
||||||
EXPORT_NAME minizip_executable)
|
|
||||||
target_compile_definitions(minizip
|
|
||||||
PRIVATE
|
|
||||||
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
|
||||||
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
|
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
|
||||||
target_link_libraries(minizip PRIVATE MINIZIP::minizip)
|
target_link_libraries(minizip PRIVATE MINIZIP::minizip)
|
||||||
add_executable(miniunzip
|
add_executable(miniunzip ${MINIUNZIP_SRCS} ${MINIUNZIP_HDRS})
|
||||||
${MINIUNZIP_SRCS}
|
set_target_properties(miniunzip PROPERTIES EXPORT_NAME miniunzip_executable)
|
||||||
${MINIUNZIP_HDRS})
|
target_compile_definitions(
|
||||||
set_target_properties(miniunzip PROPERTIES
|
miniunzip PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
||||||
EXPORT_NAME miniunzip_executable)
|
|
||||||
target_compile_definitions(miniunzip
|
|
||||||
PRIVATE
|
|
||||||
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
|
||||||
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
|
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
|
||||||
target_link_libraries(miniunzip PRIVATE MINIZIP::minizip)
|
target_link_libraries(miniunzip PRIVATE MINIZIP::minizip)
|
||||||
endif(MINIZIP_BUILD_SHARED)
|
endif(MINIZIP_BUILD_SHARED)
|
||||||
|
|
||||||
if(MINIZIP_BUILD_STATIC)
|
if(MINIZIP_BUILD_STATIC)
|
||||||
add_library(libminizipstatic STATIC
|
add_library(libminizipstatic STATIC ${LIBMINIZIP_SRCS} ${LIBMINIZIP_HDRS})
|
||||||
${LIBMINIZIP_SRCS}
|
|
||||||
${LIBMINIZIP_HDRS})
|
|
||||||
add_library(MINIZIP::minizipstatic ALIAS libminizipstatic)
|
add_library(MINIZIP::minizipstatic ALIAS libminizipstatic)
|
||||||
target_include_directories(libminizipstatic PUBLIC
|
target_include_directories(
|
||||||
$<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
|
libminizipstatic
|
||||||
|
PUBLIC $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
target_compile_definitions(libminizipstatic
|
target_compile_definitions(
|
||||||
PRIVATE
|
libminizipstatic
|
||||||
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
||||||
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
|
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
|
||||||
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
|
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
|
||||||
$<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
|
$<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
|
||||||
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>
|
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>
|
||||||
PUBLIC
|
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
|
||||||
$<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
|
set_target_properties(
|
||||||
set_target_properties(libminizipstatic PROPERTIES
|
libminizipstatic PROPERTIES EXPORT_NAME minizipstatic
|
||||||
EXPORT_NAME minizipstatic
|
|
||||||
OUTPUT_NAME minizip${minizip_static_suffix})
|
OUTPUT_NAME minizip${minizip_static_suffix})
|
||||||
|
|
||||||
if(CYGWIN)
|
if(CYGWIN)
|
||||||
set_target_properties(libminizipstatic PROPERTIES
|
set_target_properties(libminizipstatic PROPERTIES SUFFIX ".dll.a")
|
||||||
SUFFIX ".dll.a")
|
|
||||||
endif(CYGWIN)
|
endif(CYGWIN)
|
||||||
|
|
||||||
target_link_libraries(libminizipstatic PUBLIC ZLIB::ZLIBSTATIC)
|
target_link_libraries(libminizipstatic PUBLIC ZLIB::ZLIBSTATIC)
|
||||||
add_executable(minizipstatic
|
add_executable(minizipstatic ${MINIZIP_SRCS} ${MINIZIP_HDRS})
|
||||||
${MINIZIP_SRCS}
|
set_target_properties(minizipstatic PROPERTIES EXPORT_NAME
|
||||||
${MINIZIP_HDRS})
|
minizip_static_executable)
|
||||||
set_target_properties(minizipstatic PROPERTIES
|
target_compile_definitions(
|
||||||
EXPORT_NAME minizip_static_executable)
|
minizipstatic PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
||||||
target_compile_definitions(minizipstatic
|
|
||||||
PRIVATE
|
|
||||||
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
|
||||||
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
|
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
|
||||||
target_link_libraries(minizipstatic PRIVATE MINIZIP::minizipstatic)
|
target_link_libraries(minizipstatic PRIVATE MINIZIP::minizipstatic)
|
||||||
add_executable(miniunzipstatic
|
add_executable(miniunzipstatic ${MINIUNZIP_SRCS} ${MINIUNZIP_HDRS})
|
||||||
${MINIUNZIP_SRCS}
|
set_target_properties(miniunzipstatic
|
||||||
${MINIUNZIP_HDRS})
|
PROPERTIES EXPORT_NAME miniunzip_static_executable)
|
||||||
set_target_properties(miniunzipstatic PROPERTIES
|
target_compile_definitions(
|
||||||
EXPORT_NAME miniunzip_static_executable)
|
miniunzipstatic PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
||||||
target_compile_definitions(miniunzipstatic
|
|
||||||
PRIVATE
|
|
||||||
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
|
|
||||||
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
|
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
|
||||||
target_link_libraries(miniunzipstatic PRIVATE MINIZIP::minizipstatic)
|
target_link_libraries(miniunzipstatic PRIVATE MINIZIP::minizipstatic)
|
||||||
endif(MINIZIP_BUILD_STATIC)
|
endif(MINIZIP_BUILD_STATIC)
|
||||||
|
|
||||||
if(MINIZIP_INSTALL)
|
if(MINIZIP_INSTALL)
|
||||||
if(MINIZIP_BUILD_SHARED)
|
if(MINIZIP_BUILD_SHARED)
|
||||||
install(TARGETS libminizip minizip miniunzip
|
install(
|
||||||
|
TARGETS libminizip minizip miniunzip
|
||||||
COMPONENT Runtime
|
COMPONENT Runtime
|
||||||
EXPORT minizipSharedExport
|
EXPORT minizipSharedExport
|
||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
install(EXPORT minizipSharedExport
|
install(
|
||||||
|
EXPORT minizipSharedExport
|
||||||
FILE minizip-shared.cmake
|
FILE minizip-shared.cmake
|
||||||
NAMESPACE MINIZIP::
|
NAMESPACE MINIZIP::
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
|
||||||
if(MINIZIP_INSTALL_COMPAT_DLL)
|
if(MINIZIP_INSTALL_COMPAT_DLL)
|
||||||
install(FILES $<TARGET_FILE:libminizip>
|
install(
|
||||||
|
FILES $<TARGET_FILE:libminizip>
|
||||||
COMPONENT Runtime
|
COMPONENT Runtime
|
||||||
RENAME libminizip-${minizip_VERSION_MAJOR}.dll
|
RENAME libminizip-${minizip_VERSION_MAJOR}.dll
|
||||||
DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
endif(MINIZIP_INSTALL_COMPAT_DLL)
|
endif(MINIZIP_INSTALL_COMPAT_DLL)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
install(FILES $<TARGET_PDB_FILE:libminizip>
|
install(
|
||||||
|
FILES $<TARGET_PDB_FILE:libminizip>
|
||||||
COMPONENT Runtime
|
COMPONENT Runtime
|
||||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
CONFIGURATIONS Debug OR RelWithDebInfo
|
CONFIGURATIONS Debug OR RelWithDebInfo
|
||||||
OPTIONAL
|
OPTIONAL)
|
||||||
)
|
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
endif(MINIZIP_BUILD_SHARED)
|
endif(MINIZIP_BUILD_SHARED)
|
||||||
|
|
||||||
if(MINIZIP_BUILD_STATIC)
|
if(MINIZIP_BUILD_STATIC)
|
||||||
install(TARGETS libminizipstatic
|
install(
|
||||||
|
TARGETS libminizipstatic
|
||||||
COMPONENT Development
|
COMPONENT Development
|
||||||
TARGETS minizipstatic miniunzipstatic
|
TARGETS minizipstatic miniunzipstatic
|
||||||
COMPONENT Runtime
|
COMPONENT Runtime
|
||||||
@ -281,24 +244,26 @@ if(MINIZIP_INSTALL)
|
|||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
install(EXPORT minizipStaticExport
|
install(
|
||||||
|
EXPORT minizipStaticExport
|
||||||
FILE minizip-static.cmake
|
FILE minizip-static.cmake
|
||||||
NAMESPACE MINIZIP::
|
NAMESPACE MINIZIP::
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
|
||||||
endif(MINIZIP_BUILD_STATIC)
|
endif(MINIZIP_BUILD_STATIC)
|
||||||
|
|
||||||
configure_package_config_file(${minizip_SOURCE_DIR}/minizipConfig.cmake.in
|
configure_package_config_file(
|
||||||
|
${minizip_SOURCE_DIR}/minizipConfig.cmake.in
|
||||||
${minizip_BINARY_DIR}/minizipConfig.cmake
|
${minizip_BINARY_DIR}/minizipConfig.cmake
|
||||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
"${minizip_BINARY_DIR}/minizipConfigVersion.cmake"
|
"${minizip_BINARY_DIR}/minizipConfigVersion.cmake"
|
||||||
VERSION "${minizip_VERSION}"
|
VERSION "${minizip_VERSION}"
|
||||||
COMPATIBILITY AnyNewerVersion)
|
COMPATIBILITY AnyNewerVersion)
|
||||||
install(FILES
|
install(FILES ${minizip_BINARY_DIR}/minizipConfig.cmake
|
||||||
${minizip_BINARY_DIR}/minizipConfig.cmake
|
|
||||||
${minizip_BINARY_DIR}/minizipConfigVersion.cmake
|
${minizip_BINARY_DIR}/minizipConfigVersion.cmake
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
|
||||||
install(FILES ${LIBMINIZIP_HDRS}
|
install(
|
||||||
|
FILES ${LIBMINIZIP_HDRS}
|
||||||
COMPONENT Development
|
COMPONENT Development
|
||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
endif(MINIZIP_INSTALL)
|
endif(MINIZIP_INSTALL)
|
||||||
@ -306,98 +271,108 @@ endif(MINIZIP_INSTALL)
|
|||||||
if(MINIZIP_BUILD_TESTING)
|
if(MINIZIP_BUILD_TESTING)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
if(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll")
|
if(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL
|
||||||
add_test(NAME minizip_prepare_shared_zip
|
".dll")
|
||||||
COMMAND ${CMAKE_COMMAND} -DCREATE_SHARED=ON
|
add_test(
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
NAME minizip_prepare_shared_zip
|
||||||
|
COMMAND ${CMAKE_COMMAND} -DCREATE_SHARED=ON -P
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
add_test(NAME minizip_zipping_test_file_shared
|
add_test(
|
||||||
|
NAME minizip_zipping_test_file_shared
|
||||||
COMMAND minizip test_file_shared.zip test_file_shared.txt
|
COMMAND minizip test_file_shared.zip test_file_shared.txt
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
add_test(NAME minizip_prepare_shared_unzip
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} -DMOVE_SHARED=ON
|
NAME minizip_prepare_shared_unzip
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
COMMAND ${CMAKE_COMMAND} -DMOVE_SHARED=ON -P
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
add_test(NAME minizip_miniunzipping_test_file_shared.zip
|
add_test(
|
||||||
|
NAME minizip_miniunzipping_test_file_shared.zip
|
||||||
COMMAND miniunzip test_file_shared.zip
|
COMMAND miniunzip test_file_shared.zip
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
add_test(NAME minizip_compare_shared
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} -E compare_files
|
NAME minizip_compare_shared
|
||||||
test_file_shared.txt test_file_shared.orig
|
COMMAND ${CMAKE_COMMAND} -E compare_files test_file_shared.txt
|
||||||
|
test_file_shared.orig
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
add_test(NAME minizip_clean_shared_zip
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} -DDELETE_SHARED=ON
|
NAME minizip_clean_shared_zip
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
COMMAND ${CMAKE_COMMAND} -DDELETE_SHARED=ON -P
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
set_tests_properties(minizip_prepare_shared_zip
|
set_tests_properties(minizip_prepare_shared_zip
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_SETUP prepare_shared)
|
||||||
FIXTURES_SETUP prepare_shared)
|
set_tests_properties(
|
||||||
set_tests_properties(minizip_zipping_test_file_shared
|
minizip_zipping_test_file_shared
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_REQUIRED prepare_shared FIXTURES_SETUP
|
||||||
FIXTURES_REQUIRED prepare_shared
|
zip_shared)
|
||||||
FIXTURES_SETUP zip_shared)
|
set_tests_properties(
|
||||||
set_tests_properties(minizip_prepare_shared_unzip
|
minizip_prepare_shared_unzip
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_REQUIRED zip_shared FIXTURES_SETUP
|
||||||
FIXTURES_REQUIRED zip_shared
|
prepare_unzip_shared)
|
||||||
FIXTURES_SETUP prepare_unzip_shared)
|
set_tests_properties(
|
||||||
set_tests_properties(minizip_miniunzipping_test_file_shared.zip
|
minizip_miniunzipping_test_file_shared.zip
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_REQUIRED prepare_unzip_shared FIXTURES_SETUP
|
||||||
FIXTURES_REQUIRED prepare_unzip_shared
|
prepare_compare_shared)
|
||||||
FIXTURES_SETUP prepare_compare_shared)
|
set_tests_properties(
|
||||||
set_tests_properties(minizip_compare_shared
|
minizip_compare_shared
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_REQUIRED prepare_compare_shared FIXTURES_SETUP
|
||||||
FIXTURES_REQUIRED prepare_compare_shared
|
compared_shared)
|
||||||
FIXTURES_SETUP compared_shared)
|
|
||||||
set_tests_properties(minizip_clean_shared_zip
|
set_tests_properties(minizip_clean_shared_zip
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_CLEANUP compared_shared)
|
||||||
FIXTURES_CLEANUP compared_shared)
|
endif(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL
|
||||||
endif(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll")
|
".dll")
|
||||||
|
|
||||||
if(MINIZIP_BUILD_STATIC)
|
if(MINIZIP_BUILD_STATIC)
|
||||||
add_test(NAME minizip_prepare_static_zip
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} -DCREATE_STATIC=ON
|
NAME minizip_prepare_static_zip
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
COMMAND ${CMAKE_COMMAND} -DCREATE_STATIC=ON -P
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
add_test(NAME minizip_zipping_test_file_static
|
add_test(
|
||||||
|
NAME minizip_zipping_test_file_static
|
||||||
COMMAND minizipstatic test_file_static.zip test_file_static.txt
|
COMMAND minizipstatic test_file_static.zip test_file_static.txt
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
add_test(NAME minizip_prepare_static_unzip
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} -DMOVE_STATIC=ON
|
NAME minizip_prepare_static_unzip
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
COMMAND ${CMAKE_COMMAND} -DMOVE_STATIC=ON -P
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
add_test(NAME minizip_miniunzipping_test_file_static.zip
|
add_test(
|
||||||
|
NAME minizip_miniunzipping_test_file_static.zip
|
||||||
COMMAND miniunzipstatic test_file_static.zip
|
COMMAND miniunzipstatic test_file_static.zip
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
add_test(NAME minizip_compare_static
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} -E compare_files
|
NAME minizip_compare_static
|
||||||
test_file_static.txt test_file_static.orig
|
COMMAND ${CMAKE_COMMAND} -E compare_files test_file_static.txt
|
||||||
|
test_file_static.orig
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
add_test(NAME minizip_clean_static_zip
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} -DDELETE_STATIC=ON
|
NAME minizip_clean_static_zip
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
COMMAND ${CMAKE_COMMAND} -DDELETE_STATIC=ON -P
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
|
||||||
set_tests_properties(minizip_prepare_static_zip
|
set_tests_properties(minizip_prepare_static_zip
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_SETUP prepare_static)
|
||||||
FIXTURES_SETUP prepare_static)
|
set_tests_properties(
|
||||||
set_tests_properties(minizip_zipping_test_file_static
|
minizip_zipping_test_file_static
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_REQUIRED prepare_static FIXTURES_SETUP
|
||||||
FIXTURES_REQUIRED prepare_static
|
zip_static)
|
||||||
FIXTURES_SETUP zip_static)
|
set_tests_properties(
|
||||||
set_tests_properties(minizip_prepare_static_unzip
|
minizip_prepare_static_unzip
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_REQUIRED zip_static FIXTURES_SETUP
|
||||||
FIXTURES_REQUIRED zip_static
|
prepare_unzip_static)
|
||||||
FIXTURES_SETUP prepare_unzip_static)
|
set_tests_properties(
|
||||||
set_tests_properties(minizip_miniunzipping_test_file_static.zip
|
minizip_miniunzipping_test_file_static.zip
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_REQUIRED prepare_unzip_static FIXTURES_SETUP
|
||||||
FIXTURES_REQUIRED prepare_unzip_static
|
prepare_compare_static)
|
||||||
FIXTURES_SETUP prepare_compare_static)
|
set_tests_properties(
|
||||||
set_tests_properties(minizip_compare_static
|
minizip_compare_static
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_REQUIRED prepare_compare_static FIXTURES_SETUP
|
||||||
FIXTURES_REQUIRED prepare_compare_static
|
compared_static)
|
||||||
FIXTURES_SETUP compared_static)
|
|
||||||
set_tests_properties(minizip_clean_static_zip
|
set_tests_properties(minizip_clean_static_zip
|
||||||
PROPERTIES
|
PROPERTIES FIXTURES_CLEANUP compared_static)
|
||||||
FIXTURES_CLEANUP compared_static)
|
|
||||||
endif(MINIZIP_BUILD_STATIC)
|
endif(MINIZIP_BUILD_STATIC)
|
||||||
|
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
@ -15,7 +15,7 @@ if(minizip_FIND_COMPONENTS)
|
|||||||
find_dependency(ZLIB CONFIG COMPONENTS ${minizip_FIND_COMPONENTS})
|
find_dependency(ZLIB CONFIG COMPONENTS ${minizip_FIND_COMPONENTS})
|
||||||
|
|
||||||
foreach(_comp ${minizip_FIND_COMPONENTS})
|
foreach(_comp ${minizip_FIND_COMPONENTS})
|
||||||
if (NOT _comp IN_LIST _MINIZIP_supported_components)
|
if(NOT _comp IN_LIST _MINIZIP_supported_components)
|
||||||
set(minizip_FOUND False)
|
set(minizip_FOUND False)
|
||||||
set(minizip_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
|
set(minizip_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
|
||||||
endif(NOT _comp IN_LIST _MINIZIP_supported_components)
|
endif(NOT _comp IN_LIST _MINIZIP_supported_components)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#if we are built from with zlib, use this path's)
|
# if we are built from with zlib, use this path's)
|
||||||
if(DEFINED ZLIB_BUILD_SHARED)
|
if(DEFINED ZLIB_BUILD_SHARED)
|
||||||
set(WORK_DIR ${zlib_BINARY_DIR})
|
set(WORK_DIR ${zlib_BINARY_DIR})
|
||||||
set(inst_setup minizip_minizip_install)
|
set(inst_setup minizip_minizip_install)
|
||||||
@ -7,31 +7,30 @@ else(DEFINED ZLIB_BUILD_SHARED)
|
|||||||
set(inst_setup minizip_minizip_install)
|
set(inst_setup minizip_minizip_install)
|
||||||
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
|
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
|
||||||
|
|
||||||
add_test(NAME minizip_install
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} --install ${minizip_BINARY_DIR}
|
NAME minizip_install
|
||||||
--prefix ${CMAKE_CURRENT_BINARY_DIR}/test_install
|
COMMAND ${CMAKE_COMMAND} --install ${minizip_BINARY_DIR} --prefix
|
||||||
--config $<CONFIG>
|
${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
|
||||||
WORKING_DIRECTORY ${minizip_BINARY_DIR})
|
WORKING_DIRECTORY ${minizip_BINARY_DIR})
|
||||||
|
|
||||||
set_tests_properties(minizip_install
|
set_tests_properties(minizip_install PROPERTIES FIXTURES_SETUP
|
||||||
PROPERTIES
|
minizip_install)
|
||||||
FIXTURES_SETUP minizip_install)
|
|
||||||
endif(DEFINED ZLIB_BUILD_SHARED)
|
endif(DEFINED ZLIB_BUILD_SHARED)
|
||||||
|
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
|
configure_file(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
|
||||||
@ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
|
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt
|
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
|
||||||
@ONLY)
|
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
|
configure_file(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
|
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
|
||||||
@ONLY)
|
@ONLY)
|
||||||
|
|
||||||
@ -45,83 +44,78 @@ endif(GENERATOR)
|
|||||||
#
|
#
|
||||||
# findpackage_test
|
# findpackage_test
|
||||||
#
|
#
|
||||||
add_test(NAME minizip_find_package_configure
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND}
|
NAME minizip_find_package_configure
|
||||||
${PLATFORM}
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} ${PLATFORM}
|
||||||
-B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
|
-B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
|
||||||
-DCMAKE_BUILD_TYPE=$<CONFIG>
|
-DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
||||||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||||
-DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install
|
-DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
|
||||||
${ZLIB_ARG}
|
--fresh -G "${CMAKE_GENERATOR}"
|
||||||
--fresh
|
|
||||||
-G "${CMAKE_GENERATOR}"
|
|
||||||
-S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
-S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
||||||
|
|
||||||
add_test(NAME minizip_find_package_build
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} --build .
|
NAME minizip_find_package_build
|
||||||
--config $<CONFIG>
|
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
|
||||||
|
|
||||||
set_tests_properties(minizip_find_package_configure PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED ${inst_setup}
|
minizip_find_package_configure PROPERTIES FIXTURES_REQUIRED ${inst_setup}
|
||||||
FIXTURES_SETUP mzfp_config)
|
FIXTURES_SETUP mzfp_config)
|
||||||
|
|
||||||
set_tests_properties(minizip_find_package_build PROPERTIES
|
set_tests_properties(minizip_find_package_build PROPERTIES FIXTURES_REQUIRED
|
||||||
FIXTURES_REQUIRED mzfp_config)
|
mzfp_config)
|
||||||
|
|
||||||
#
|
#
|
||||||
# add_subdirectory_test
|
# add_subdirectory_test
|
||||||
#
|
#
|
||||||
add_test(NAME minizip_add_subdirectory_configure
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND}
|
NAME minizip_add_subdirectory_configure
|
||||||
${PLATFORM}
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} ${PLATFORM}
|
||||||
-B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
|
-B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
|
||||||
-DCMAKE_BUILD_TYPE=$<CONFIG>
|
-DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
||||||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||||
-DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install
|
-DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
|
||||||
${ZLIB_ARG}
|
--fresh -G "${CMAKE_GENERATOR}"
|
||||||
--fresh
|
|
||||||
-G "${CMAKE_GENERATOR}"
|
|
||||||
-S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
|
-S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
|
||||||
|
|
||||||
add_test(NAME minizip_add_subdirectory_build
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} --build .
|
NAME minizip_add_subdirectory_build
|
||||||
--config $<CONFIG>
|
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
|
||||||
|
|
||||||
set_tests_properties(minizip_add_subdirectory_configure PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED ${inst_setup}
|
minizip_add_subdirectory_configure
|
||||||
FIXTURES_SETUP mzas_config)
|
PROPERTIES FIXTURES_REQUIRED ${inst_setup} FIXTURES_SETUP mzas_config)
|
||||||
|
|
||||||
set_tests_properties(minizip_add_subdirectory_build PROPERTIES
|
set_tests_properties(minizip_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED
|
||||||
FIXTURES_REQUIRED mzas_config)
|
mzas_config)
|
||||||
|
|
||||||
#
|
#
|
||||||
# add_subdirectory_exclude_test
|
# add_subdirectory_exclude_test
|
||||||
#
|
#
|
||||||
add_test(NAME minizip_add_subdirectory_exclude_configure
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND}
|
NAME minizip_add_subdirectory_exclude_configure
|
||||||
${PLATFORM}
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} ${PLATFORM}
|
||||||
-B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
|
-B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
|
||||||
-DCMAKE_BUILD_TYPE=$<CONFIG>
|
-DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
||||||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||||
-DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install
|
-DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
|
||||||
${ZLIB_ARG}
|
--fresh -G "${CMAKE_GENERATOR}"
|
||||||
--fresh
|
|
||||||
-G "${CMAKE_GENERATOR}"
|
|
||||||
-S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
|
-S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
|
||||||
|
|
||||||
add_test(NAME minizip_add_subdirectory_exclude_build
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} --build .
|
NAME minizip_add_subdirectory_exclude_build
|
||||||
--config $<CONFIG>
|
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
|
WORKING_DIRECTORY
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
|
||||||
|
|
||||||
set_tests_properties(minizip_add_subdirectory_exclude_configure PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED ${inst_setup}
|
minizip_add_subdirectory_exclude_configure
|
||||||
FIXTURES_SETUP mzasx_config)
|
PROPERTIES FIXTURES_REQUIRED ${inst_setup} FIXTURES_SETUP mzasx_config)
|
||||||
|
|
||||||
set_tests_properties(minizip_add_subdirectory_exclude_build PROPERTIES
|
set_tests_properties(minizip_add_subdirectory_exclude_build
|
||||||
FIXTURES_REQUIRED mzasx_config)
|
PROPERTIES FIXTURES_REQUIRED mzasx_config)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
project(minizip_add_subdirectory_exclude_from_all
|
project(
|
||||||
|
minizip_add_subdirectory_exclude_from_all
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
VERSION @minizip_VERSION@)
|
VERSION @minizip_VERSION@)
|
||||||
|
|
||||||
@ -9,13 +10,13 @@ option(MINIZIP_BUILD_SHARED "" @MINIZIP_BUILD_SHARED@)
|
|||||||
option(MINIZIP_BUILD_STATIC "" @MINIZIP_BUILD_STATIC@)
|
option(MINIZIP_BUILD_STATIC "" @MINIZIP_BUILD_STATIC@)
|
||||||
option(MINIZIP_ENABLE_BZIP2 "" @MINIZIP_ENABLE_BZIP2@)
|
option(MINIZIP_ENABLE_BZIP2 "" @MINIZIP_ENABLE_BZIP2@)
|
||||||
|
|
||||||
add_subdirectory(@minizip_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/minizip EXCLUDE_FROM_ALL)
|
add_subdirectory(@minizip_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/minizip
|
||||||
|
EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
set(MINIZIP_SRCS
|
set(MINIZIP_SRCS
|
||||||
@minizip_SOURCE_DIR@/ioapi.c
|
@minizip_SOURCE_DIR@/ioapi.c
|
||||||
$<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
|
$<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
|
||||||
@minizip_SOURCE_DIR@/minizip.c
|
@minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c)
|
||||||
@minizip_SOURCE_DIR@/zip.c)
|
|
||||||
|
|
||||||
if(MINIZIP_BUILD_SHARED)
|
if(MINIZIP_BUILD_SHARED)
|
||||||
add_executable(test_example ${MINIZIP_SRCS})
|
add_executable(test_example ${MINIZIP_SRCS})
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
project(minizip_add_subdirectory_exclude_from_all
|
project(
|
||||||
|
minizip_add_subdirectory_exclude_from_all
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
VERSION @minizip_VERSION@)
|
VERSION @minizip_VERSION@)
|
||||||
|
|
||||||
@ -14,8 +15,7 @@ add_subdirectory(@minizip_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/minizip)
|
|||||||
set(MINIZIP_SRCS
|
set(MINIZIP_SRCS
|
||||||
@minizip_SOURCE_DIR@/ioapi.c
|
@minizip_SOURCE_DIR@/ioapi.c
|
||||||
$<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
|
$<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
|
||||||
@minizip_SOURCE_DIR@/minizip.c
|
@minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c)
|
||||||
@minizip_SOURCE_DIR@/zip.c)
|
|
||||||
|
|
||||||
if(MINIZIP_BUILD_SHARED)
|
if(MINIZIP_BUILD_SHARED)
|
||||||
add_executable(test_example ${MINIZIP_SRCS})
|
add_executable(test_example ${MINIZIP_SRCS})
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
project(minizip_find_package
|
project(
|
||||||
|
minizip_find_package
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
VERSION @minizip_VERSION@)
|
VERSION @minizip_VERSION@)
|
||||||
|
|
||||||
@ -11,8 +12,7 @@ find_package(minizip ${minizip_VERSION} CONFIG REQUIRED)
|
|||||||
set(MINIZIP_SRCS
|
set(MINIZIP_SRCS
|
||||||
@minizip_SOURCE_DIR@/ioapi.c
|
@minizip_SOURCE_DIR@/ioapi.c
|
||||||
$<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
|
$<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
|
||||||
@minizip_SOURCE_DIR@/minizip.c
|
@minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c)
|
||||||
@minizip_SOURCE_DIR@/zip.c)
|
|
||||||
|
|
||||||
if(MINIZIP_BUILD_SHARED)
|
if(MINIZIP_BUILD_SHARED)
|
||||||
add_executable(test_example ${MINIZIP_SRCS})
|
add_executable(test_example ${MINIZIP_SRCS})
|
||||||
|
@ -1,68 +1,78 @@
|
|||||||
function (ZLIB_findTestEnv testName)
|
function(ZLIB_findTestEnv testName)
|
||||||
set (testEnv "PATH=")
|
set(testEnv "PATH=")
|
||||||
|
|
||||||
if (MSVC OR MINGW)
|
if(MSVC OR MINGW)
|
||||||
set (separator "\\\;")
|
set(separator "\\\;")
|
||||||
else()
|
else()
|
||||||
set (separator ":")
|
set(separator ":")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
string (APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}")
|
string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}")
|
||||||
string (APPEND testEnv "$ENV{PATH}")
|
string(APPEND testEnv "$ENV{PATH}")
|
||||||
|
|
||||||
set_tests_properties (${testName} PROPERTIES
|
set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
|
||||||
ENVIRONMENT "${testEnv}"
|
|
||||||
)
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if(ZLIB_BUILD_SHARED)
|
if(ZLIB_BUILD_SHARED)
|
||||||
add_executable(zlib_example example.c)
|
add_executable(zlib_example example.c)
|
||||||
target_link_libraries(zlib_example ZLIB::ZLIB)
|
target_link_libraries(zlib_example ZLIB::ZLIB)
|
||||||
add_test(NAME zlib_example
|
add_test(NAME zlib_example COMMAND zlib_example)
|
||||||
COMMAND zlib_example)
|
|
||||||
|
|
||||||
add_executable(minigzip minigzip.c)
|
add_executable(minigzip minigzip.c)
|
||||||
target_compile_definitions(minigzip
|
target_compile_definitions(
|
||||||
PRIVATE
|
minigzip PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
|
||||||
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
|
|
||||||
target_link_libraries(minigzip ZLIB::ZLIB)
|
target_link_libraries(minigzip ZLIB::ZLIB)
|
||||||
|
|
||||||
if (MSVC OR MSYS OR MINGW OR CYGWIN)
|
if(MSVC
|
||||||
ZLIB_findTestEnv (zlib_example)
|
OR MSYS
|
||||||
endif (MSVC OR MSYS OR MINGW OR CYGWIN)
|
OR MINGW
|
||||||
|
OR CYGWIN)
|
||||||
|
zlib_findtestenv(zlib_example)
|
||||||
|
endif(
|
||||||
|
MSVC
|
||||||
|
OR MSYS
|
||||||
|
OR MINGW
|
||||||
|
OR CYGWIN)
|
||||||
|
|
||||||
if(HAVE_OFF64_T)
|
if(HAVE_OFF64_T)
|
||||||
add_executable(zlib_example64 example.c)
|
add_executable(zlib_example64 example.c)
|
||||||
target_compile_definitions(zlib_example64
|
target_compile_definitions(
|
||||||
PRIVATE
|
zlib_example64
|
||||||
LARGEFILE64_SOURCE=1
|
PRIVATE LARGEFILE64_SOURCE=1
|
||||||
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
|
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
|
||||||
target_link_libraries(zlib_example64 ZLIB::ZLIB)
|
target_link_libraries(zlib_example64 ZLIB::ZLIB)
|
||||||
add_test(NAME zlib_example64
|
add_test(NAME zlib_example64 COMMAND zlib_example64)
|
||||||
COMMAND zlib_example64)
|
|
||||||
|
|
||||||
if (MSVC OR MSYS OR MINGW OR CYGWIN)
|
if(MSVC
|
||||||
ZLIB_findTestEnv (zlib_example64)
|
OR MSYS
|
||||||
endif (MSVC OR MSYS OR MINGW OR CYGWIN)
|
OR MINGW
|
||||||
|
OR CYGWIN)
|
||||||
|
zlib_findtestenv(zlib_example64)
|
||||||
|
endif(
|
||||||
|
MSVC
|
||||||
|
OR MSYS
|
||||||
|
OR MINGW
|
||||||
|
OR CYGWIN)
|
||||||
endif(HAVE_OFF64_T)
|
endif(HAVE_OFF64_T)
|
||||||
endif(ZLIB_BUILD_SHARED)
|
endif(ZLIB_BUILD_SHARED)
|
||||||
|
|
||||||
if(ZLIB_BUILD_STATIC)
|
if(ZLIB_BUILD_STATIC)
|
||||||
add_executable(zlib_static_example example.c)
|
add_executable(zlib_static_example example.c)
|
||||||
target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC)
|
target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC)
|
||||||
target_compile_definitions(zlib_static_example
|
target_compile_definitions(
|
||||||
PRIVATE
|
zlib_static_example
|
||||||
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
|
PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
|
||||||
add_test(NAME zlib_static_example
|
add_test(NAME zlib_static_example COMMAND zlib_static_example)
|
||||||
COMMAND zlib_static_example)
|
|
||||||
|
|
||||||
add_executable(static_minigzip minigzip.c)
|
add_executable(static_minigzip minigzip.c)
|
||||||
target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC)
|
target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC)
|
||||||
|
|
||||||
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
|
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL
|
||||||
${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
|
"Clang")
|
||||||
set(CFLAGS_OLD ${CMAKE_C_FLAGS})
|
set(CFLAGS_OLD ${CMAKE_C_FLAGS})
|
||||||
set({CMAKE_C_FLAGS "" CACHE STRING "" FORCE)
|
set({CMAKE_C_FLAGS
|
||||||
|
""
|
||||||
|
CACHE STRING "" FORCE)
|
||||||
|
|
||||||
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
|
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
|
||||||
find_program(GCOV_EXECUTABLE gcov)
|
find_program(GCOV_EXECUTABLE gcov)
|
||||||
@ -84,57 +94,57 @@ if(ZLIB_BUILD_STATIC)
|
|||||||
target_link_libraries(infcover ZLIB::ZLIBSTATIC)
|
target_link_libraries(infcover ZLIB::ZLIBSTATIC)
|
||||||
target_compile_options(infcover PRIVATE -coverage)
|
target_compile_options(infcover PRIVATE -coverage)
|
||||||
target_link_options(infcover PRIVATE -coverage)
|
target_link_options(infcover PRIVATE -coverage)
|
||||||
target_compile_definitions(infcover
|
target_compile_definitions(
|
||||||
PRIVATE
|
infcover PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
|
||||||
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
|
add_test(NAME zlib-coverage COMMAND infcover)
|
||||||
add_test (NAME zlib-coverage COMMAND infcover)
|
set(INFCOVER_DIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/infcover.dir)
|
||||||
set (INFCOVER_DIR
|
add_test(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/infcover.dir)
|
NAME zlib-coverage-summary
|
||||||
add_test (NAME zlib-coverage-summary
|
COMMAND
|
||||||
COMMAND ${GCOV_EXECUTABLE} ${llvm_option}
|
${GCOV_EXECUTABLE} ${llvm_option}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/infcover.c
|
${CMAKE_CURRENT_SOURCE_DIR}/infcover.c -o
|
||||||
-o ${INFCOVER_DIR}/infcover.c.gcda)
|
${INFCOVER_DIR}/infcover.c.gcda)
|
||||||
set_tests_properties(zlib-coverage-summary PROPERTIES DEPENDS zlib-coverage)
|
set_tests_properties(zlib-coverage-summary PROPERTIES DEPENDS
|
||||||
set({CMAKE_C_FLAGS ${CFLAGS_OLD} CACHE STRING "" FORCE)
|
zlib-coverage)
|
||||||
endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR
|
set({CMAKE_C_FLAGS
|
||||||
${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
|
${CFLAGS_OLD}
|
||||||
|
CACHE STRING "" FORCE)
|
||||||
|
endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID}
|
||||||
|
STREQUAL "Clang")
|
||||||
|
|
||||||
if(HAVE_OFF64_T)
|
if(HAVE_OFF64_T)
|
||||||
add_executable(zlib_static_example64 example.c)
|
add_executable(zlib_static_example64 example.c)
|
||||||
target_compile_definitions(zlib_static_example64
|
target_compile_definitions(
|
||||||
PRIVATE
|
zlib_static_example64
|
||||||
LARGEFILE64_SOURCE=1
|
PRIVATE LARGEFILE64_SOURCE=1
|
||||||
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
|
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>)
|
||||||
target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC)
|
target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC)
|
||||||
add_test(NAME zlib_static_example64
|
add_test(NAME zlib_static_example64 COMMAND zlib_static_example64)
|
||||||
COMMAND zlib_static_example64)
|
|
||||||
endif(HAVE_OFF64_T)
|
endif(HAVE_OFF64_T)
|
||||||
endif(ZLIB_BUILD_STATIC)
|
endif(ZLIB_BUILD_STATIC)
|
||||||
|
|
||||||
add_test(NAME zlib_install
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} --install ${zlib_BINARY_DIR}
|
NAME zlib_install
|
||||||
--prefix ${CMAKE_CURRENT_BINARY_DIR}/test_install
|
COMMAND ${CMAKE_COMMAND} --install ${zlib_BINARY_DIR} --prefix
|
||||||
--config $<CONFIG>
|
${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
|
||||||
WORKING_DIRECTORY ${zlib_BINARY_DIR})
|
WORKING_DIRECTORY ${zlib_BINARY_DIR})
|
||||||
|
|
||||||
set_tests_properties(zlib_install
|
set_tests_properties(zlib_install PROPERTIES FIXTURES_SETUP zlib_install)
|
||||||
PROPERTIES
|
|
||||||
FIXTURES_SETUP zlib_install)
|
|
||||||
|
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
|
configure_file(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
|
||||||
@ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
|
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt
|
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
|
||||||
@ONLY)
|
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
|
configure_file(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
|
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
|
||||||
@ONLY)
|
@ONLY)
|
||||||
|
|
||||||
@ -147,107 +157,107 @@ endif(GENERATOR)
|
|||||||
#
|
#
|
||||||
# findpackage_test
|
# findpackage_test
|
||||||
#
|
#
|
||||||
add_test(NAME zlib_find_package_configure
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND}
|
NAME zlib_find_package_configure
|
||||||
${PLATFORM}
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} ${PLATFORM}
|
||||||
-B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
|
-B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
|
||||||
-DCMAKE_BUILD_TYPE=$<CONFIG>
|
-DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
||||||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
|
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
|
||||||
--fresh
|
-G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
||||||
-G "${CMAKE_GENERATOR}"
|
|
||||||
-S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
|
||||||
|
|
||||||
add_test(NAME zlib_find_package_build
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} --build .
|
NAME zlib_find_package_build
|
||||||
--config $<CONFIG>
|
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
|
||||||
|
|
||||||
add_test(NAME zlib_find_package_test
|
add_test(
|
||||||
|
NAME zlib_find_package_test
|
||||||
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
|
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
|
||||||
|
|
||||||
set_tests_properties(zlib_find_package_configure PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED zlib_install
|
zlib_find_package_configure PROPERTIES FIXTURES_REQUIRED zlib_install
|
||||||
FIXTURES_SETUP fp_config)
|
FIXTURES_SETUP fp_config)
|
||||||
|
|
||||||
set_tests_properties(zlib_find_package_build PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED fp_config
|
zlib_find_package_build PROPERTIES FIXTURES_REQUIRED fp_config
|
||||||
FIXTURES_SETUP fp_build)
|
FIXTURES_SETUP fp_build)
|
||||||
|
|
||||||
set_tests_properties(zlib_find_package_test PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED fp_build
|
zlib_find_package_test PROPERTIES FIXTURES_REQUIRED fp_build ENVIRONMENT
|
||||||
ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1)
|
CTEST_OUTPUT_ON_FAILURE=1)
|
||||||
|
|
||||||
#
|
#
|
||||||
# add_subdirectory_test
|
# add_subdirectory_test
|
||||||
#
|
#
|
||||||
add_test(NAME zlib_add_subdirectory_configure
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND}
|
NAME zlib_add_subdirectory_configure
|
||||||
${PLATFORM}
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} ${PLATFORM}
|
||||||
-B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
|
-B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
|
||||||
-DCMAKE_BUILD_TYPE=$<CONFIG>
|
-DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
||||||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
|
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
|
||||||
--fresh
|
-G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
||||||
-G "${CMAKE_GENERATOR}"
|
|
||||||
-S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
|
||||||
|
|
||||||
add_test(NAME zlib_add_subdirectory_build
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} --build .
|
NAME zlib_add_subdirectory_build
|
||||||
--config $<CONFIG>
|
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
|
||||||
|
|
||||||
add_test(NAME zlib_add_subdirectory_test
|
add_test(
|
||||||
|
NAME zlib_add_subdirectory_test
|
||||||
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
|
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
|
||||||
|
|
||||||
set_tests_properties(zlib_add_subdirectory_configure PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED zlib_install
|
zlib_add_subdirectory_configure PROPERTIES FIXTURES_REQUIRED zlib_install
|
||||||
FIXTURES_SETUP as_config)
|
FIXTURES_SETUP as_config)
|
||||||
|
|
||||||
set_tests_properties(zlib_add_subdirectory_build PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED as_config
|
zlib_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED as_config
|
||||||
FIXTURES_SETUP as_build)
|
FIXTURES_SETUP as_build)
|
||||||
|
|
||||||
set_tests_properties(zlib_add_subdirectory_test PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED as_build
|
zlib_add_subdirectory_test PROPERTIES FIXTURES_REQUIRED as_build
|
||||||
ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1)
|
ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1)
|
||||||
|
|
||||||
#
|
#
|
||||||
# add_subdirectory_exclude_test
|
# add_subdirectory_exclude_test
|
||||||
#
|
#
|
||||||
add_test(NAME zlib_add_subdirectory_exclude_configure
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND}
|
NAME zlib_add_subdirectory_exclude_configure
|
||||||
${PLATFORM}
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} ${PLATFORM}
|
||||||
-B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
|
-B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
|
||||||
-DCMAKE_BUILD_TYPE=$<CONFIG>
|
-DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
||||||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install
|
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh
|
||||||
--fresh
|
-G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
||||||
-G "${CMAKE_GENERATOR}"
|
|
||||||
-S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
|
||||||
|
|
||||||
add_test(NAME zlib_add_subdirectory_exclude_build
|
add_test(
|
||||||
COMMAND ${CMAKE_COMMAND} --build .
|
NAME zlib_add_subdirectory_exclude_build
|
||||||
--config $<CONFIG>
|
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
|
WORKING_DIRECTORY
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
|
||||||
|
|
||||||
add_test(NAME zlib_add_subdirectory_exclude_test
|
add_test(
|
||||||
|
NAME zlib_add_subdirectory_exclude_test
|
||||||
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
|
COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG>
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
|
WORKING_DIRECTORY
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
|
||||||
|
|
||||||
set_tests_properties(zlib_add_subdirectory_exclude_configure PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED zlib_install
|
zlib_add_subdirectory_exclude_configure
|
||||||
FIXTURES_SETUP asx_config)
|
PROPERTIES FIXTURES_REQUIRED zlib_install FIXTURES_SETUP asx_config)
|
||||||
|
|
||||||
set_tests_properties(zlib_add_subdirectory_exclude_build PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED as_config
|
zlib_add_subdirectory_exclude_build PROPERTIES FIXTURES_REQUIRED as_config
|
||||||
FIXTURES_SETUP asx_build)
|
FIXTURES_SETUP asx_build)
|
||||||
|
|
||||||
set_tests_properties(zlib_add_subdirectory_exclude_test PROPERTIES
|
set_tests_properties(
|
||||||
FIXTURES_REQUIRED asx_build
|
zlib_add_subdirectory_exclude_test
|
||||||
ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1)
|
PROPERTIES FIXTURES_REQUIRED asx_build ENVIRONMENT
|
||||||
|
CTEST_OUTPUT_ON_FAILURE=1)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(zlib_find_package_test
|
project(
|
||||||
|
zlib_find_package_test
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
VERSION @zlib_VERSION@)
|
VERSION @zlib_VERSION@)
|
||||||
|
|
||||||
@ -9,7 +10,8 @@ option(ZLIB_BUILD_TESTING "" OFF)
|
|||||||
option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
|
option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
|
||||||
option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
|
option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
|
||||||
|
|
||||||
add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib EXCLUDE_FROM_ALL)
|
add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib
|
||||||
|
EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
if(ZLIB_BUILD_SHARED)
|
if(ZLIB_BUILD_SHARED)
|
||||||
add_executable(test_example @zlib_SOURCE_DIR@/test/example.c)
|
add_executable(test_example @zlib_SOURCE_DIR@/test/example.c)
|
||||||
@ -23,6 +25,5 @@ endif(ZLIB_BUILD_SHARED)
|
|||||||
if(ZLIB_BUILD_STATIC)
|
if(ZLIB_BUILD_STATIC)
|
||||||
add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
|
add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
|
||||||
target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
|
target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
|
||||||
add_test(NAME zlib_test_example_static
|
add_test(NAME zlib_test_example_static COMMAND test_example_static)
|
||||||
COMMAND test_example_static)
|
|
||||||
endif(ZLIB_BUILD_STATIC)
|
endif(ZLIB_BUILD_STATIC)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(zlib_find_package_test
|
project(
|
||||||
|
zlib_find_package_test
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
VERSION @zlib_VERSION@)
|
VERSION @zlib_VERSION@)
|
||||||
|
|
||||||
@ -23,6 +24,5 @@ endif(ZLIB_BUILD_SHARED)
|
|||||||
if(ZLIB_BUILD_STATIC)
|
if(ZLIB_BUILD_STATIC)
|
||||||
add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
|
add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
|
||||||
target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
|
target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
|
||||||
add_test(NAME zlib_test_example_static
|
add_test(NAME zlib_test_example_static COMMAND test_example_static)
|
||||||
COMMAND test_example_static)
|
|
||||||
endif(@ZLIB_BUILD_STATIC)
|
endif(@ZLIB_BUILD_STATIC)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(zlib_find_package_test
|
project(
|
||||||
|
zlib_find_package_test
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
VERSION @zlib_VERSION@)
|
VERSION @zlib_VERSION@)
|
||||||
|
|
||||||
@ -21,6 +22,5 @@ endif(ZLIB_BUILD_SHARED)
|
|||||||
if(ZLIB_BUILD_STATIC)
|
if(ZLIB_BUILD_STATIC)
|
||||||
add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
|
add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
|
||||||
target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
|
target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
|
||||||
add_test(NAME zlib_test_example_static
|
add_test(NAME zlib_test_example_static COMMAND test_example_static)
|
||||||
COMMAND test_example_static)
|
|
||||||
endif(ZLIB_BUILD_STATIC)
|
endif(ZLIB_BUILD_STATIC)
|
||||||
|
@ -12,7 +12,7 @@ endif(@ZLIB_BUILD_STATIC@)
|
|||||||
|
|
||||||
if(ZLIB_FIND_COMPONENTS)
|
if(ZLIB_FIND_COMPONENTS)
|
||||||
foreach(_comp ${ZLIB_FIND_COMPONENTS})
|
foreach(_comp ${ZLIB_FIND_COMPONENTS})
|
||||||
if (NOT _comp IN_LIST _ZLIB_supported_components)
|
if(NOT _comp IN_LIST _ZLIB_supported_components)
|
||||||
set(ZLIB_FOUND False)
|
set(ZLIB_FOUND False)
|
||||||
set(ZLIB_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
|
set(ZLIB_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
|
||||||
endif(NOT _comp IN_LIST _ZLIB_supported_components)
|
endif(NOT _comp IN_LIST _ZLIB_supported_components)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user