diff options
| author | Vollstrecker <werner@vollstreckernet.de> | 2025-01-03 09:50:16 +0100 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2025-01-31 20:02:26 -0800 |
| commit | 8b8a124eb42b027dceab01c7d4942a18c756d28e (patch) | |
| tree | bc8d9427d1689be996af87276e3a6d3371cae267 | |
| parent | 4f2671d50cf0f8632c9f6e84b884aba5031e4016 (diff) | |
| download | zlib-8b8a124eb42b027dceab01c7d4942a18c756d28e.tar.gz zlib-8b8a124eb42b027dceab01c7d4942a18c756d28e.tar.bz2 zlib-8b8a124eb42b027dceab01c7d4942a18c756d28e.zip | |
CMake: Add cmake-format.yaml and reformat the cmake files.
| -rw-r--r-- | .cmake-format.yaml | 245 | ||||
| -rw-r--r-- | CMakeLists.txt | 224 | ||||
| -rw-r--r-- | contrib/minizip/CMakeLists.txt | 391 | ||||
| -rw-r--r-- | contrib/minizip/minizipConfig.cmake.in | 2 | ||||
| -rw-r--r-- | contrib/minizip/test/CMakeLists.txt | 146 | ||||
| -rw-r--r-- | contrib/minizip/test/add_subdirectory_exclude_test.cmake.in | 9 | ||||
| -rw-r--r-- | contrib/minizip/test/add_subdirectory_test.cmake.in | 6 | ||||
| -rw-r--r-- | contrib/minizip/test/find_package_test.cmake.in | 6 | ||||
| -rw-r--r-- | test/CMakeLists.txt | 306 | ||||
| -rw-r--r-- | test/add_subdirectory_exclude_test.cmake.in | 9 | ||||
| -rw-r--r-- | test/add_subdirectory_test.cmake.in | 6 | ||||
| -rw-r--r-- | test/find_package_test.cmake.in | 6 | ||||
| -rw-r--r-- | zlibConfig.cmake.in | 2 |
13 files changed, 798 insertions, 560 deletions
diff --git a/.cmake-format.yaml b/.cmake-format.yaml new file mode 100644 index 0000000..9c554da --- /dev/null +++ b/.cmake-format.yaml | |||
| @@ -0,0 +1,245 @@ | |||
| 1 | _help_parse: Options affecting listfile parsing | ||
| 2 | parse: | ||
| 3 | _help_additional_commands: | ||
| 4 | - Specify structure for custom cmake functions | ||
| 5 | additional_commands: | ||
| 6 | foo: | ||
| 7 | flags: | ||
| 8 | - BAR | ||
| 9 | - BAZ | ||
| 10 | kwargs: | ||
| 11 | HEADERS: '*' | ||
| 12 | SOURCES: '*' | ||
| 13 | DEPENDS: '*' | ||
| 14 | _help_override_spec: | ||
| 15 | - Override configurations per-command where available | ||
| 16 | override_spec: {} | ||
| 17 | _help_vartags: | ||
| 18 | - Specify variable tags. | ||
| 19 | vartags: [] | ||
| 20 | _help_proptags: | ||
| 21 | - Specify property tags. | ||
| 22 | proptags: [] | ||
| 23 | _help_format: Options affecting formatting. | ||
| 24 | format: | ||
| 25 | _help_disable: | ||
| 26 | - Disable formatting entirely, making cmake-format a no-op | ||
| 27 | disable: false | ||
| 28 | _help_line_width: | ||
| 29 | - How wide to allow formatted cmake files | ||
| 30 | line_width: 80 | ||
| 31 | _help_tab_size: | ||
| 32 | - How many spaces to tab for indent | ||
| 33 | tab_size: 4 | ||
| 34 | _help_use_tabchars: | ||
| 35 | - If true, lines are indented using tab characters (utf-8 | ||
| 36 | - 0x09) instead of <tab_size> space characters (utf-8 0x20). | ||
| 37 | - In cases where the layout would require a fractional tab | ||
| 38 | - character, the behavior of the fractional indentation is | ||
| 39 | - governed by <fractional_tab_policy> | ||
| 40 | use_tabchars: false | ||
| 41 | _help_fractional_tab_policy: | ||
| 42 | - If <use_tabchars> is True, then the value of this variable | ||
| 43 | - indicates how fractional indentions are handled during | ||
| 44 | - whitespace replacement. If set to 'use-space', fractional | ||
| 45 | - indentation is left as spaces (utf-8 0x20). If set to | ||
| 46 | - '`round-up` fractional indentation is replaced with a single' | ||
| 47 | - tab character (utf-8 0x09) effectively shifting the column | ||
| 48 | - to the next tabstop | ||
| 49 | fractional_tab_policy: use-space | ||
| 50 | _help_max_subgroups_hwrap: | ||
| 51 | - If an argument group contains more than this many sub-groups | ||
| 52 | - (parg or kwarg groups) then force it to a vertical layout. | ||
| 53 | max_subgroups_hwrap: 2 | ||
| 54 | _help_max_pargs_hwrap: | ||
| 55 | - If a positional argument group contains more than this many | ||
| 56 | - arguments, then force it to a vertical layout. | ||
| 57 | max_pargs_hwrap: 6 | ||
| 58 | _help_max_rows_cmdline: | ||
| 59 | - If a cmdline positional group consumes more than this many | ||
| 60 | - lines without nesting, then invalidate the layout (and nest) | ||
| 61 | max_rows_cmdline: 2 | ||
| 62 | _help_separate_ctrl_name_with_space: | ||
| 63 | - If true, separate flow control names from their parentheses | ||
| 64 | - with a space | ||
| 65 | separate_ctrl_name_with_space: false | ||
| 66 | _help_separate_fn_name_with_space: | ||
| 67 | - If true, separate function names from parentheses with a | ||
| 68 | - space | ||
| 69 | separate_fn_name_with_space: false | ||
| 70 | _help_dangle_parens: | ||
| 71 | - If a statement is wrapped to more than one line, than dangle | ||
| 72 | - the closing parenthesis on its own line. | ||
| 73 | dangle_parens: false | ||
| 74 | _help_dangle_align: | ||
| 75 | - If the trailing parenthesis must be 'dangled' on its on | ||
| 76 | - 'line, then align it to this reference: `prefix`: the start' | ||
| 77 | - 'of the statement, `prefix-indent`: the start of the' | ||
| 78 | - 'statement, plus one indentation level, `child`: align to' | ||
| 79 | - the column of the arguments | ||
| 80 | dangle_align: prefix | ||
| 81 | _help_min_prefix_chars: | ||
| 82 | - If the statement spelling length (including space and | ||
| 83 | - parenthesis) is smaller than this amount, then force reject | ||
| 84 | - nested layouts. | ||
| 85 | min_prefix_chars: 4 | ||
| 86 | _help_max_prefix_chars: | ||
| 87 | - If the statement spelling length (including space and | ||
| 88 | - parenthesis) is larger than the tab width by more than this | ||
| 89 | - amount, then force reject un-nested layouts. | ||
| 90 | max_prefix_chars: 10 | ||
| 91 | _help_max_lines_hwrap: | ||
| 92 | - If a candidate layout is wrapped horizontally but it exceeds | ||
| 93 | - this many lines, then reject the layout. | ||
| 94 | max_lines_hwrap: 2 | ||
| 95 | _help_line_ending: | ||
| 96 | - What style line endings to use in the output. | ||
| 97 | line_ending: unix | ||
| 98 | _help_command_case: | ||
| 99 | - Format command names consistently as 'lower' or 'upper' case | ||
| 100 | command_case: canonical | ||
| 101 | _help_keyword_case: | ||
| 102 | - Format keywords consistently as 'lower' or 'upper' case | ||
| 103 | keyword_case: unchanged | ||
| 104 | _help_always_wrap: | ||
| 105 | - A list of command names which should always be wrapped | ||
| 106 | always_wrap: [] | ||
| 107 | _help_enable_sort: | ||
| 108 | - If true, the argument lists which are known to be sortable | ||
| 109 | - will be sorted lexicographicall | ||
| 110 | enable_sort: true | ||
| 111 | _help_autosort: | ||
| 112 | - If true, the parsers may infer whether or not an argument | ||
| 113 | - list is sortable (without annotation). | ||
| 114 | autosort: false | ||
| 115 | _help_require_valid_layout: | ||
| 116 | - By default, if cmake-format cannot successfully fit | ||
| 117 | - everything into the desired linewidth it will apply the | ||
| 118 | - last, most aggressive attempt that it made. If this flag is | ||
| 119 | - True, however, cmake-format will print error, exit with non- | ||
| 120 | - zero status code, and write-out nothing | ||
| 121 | require_valid_layout: false | ||
| 122 | _help_layout_passes: | ||
| 123 | - A dictionary mapping layout nodes to a list of wrap | ||
| 124 | - decisions. See the documentation for more information. | ||
| 125 | layout_passes: {} | ||
| 126 | _help_markup: Options affecting comment reflow and formatting. | ||
| 127 | markup: | ||
| 128 | _help_bullet_char: | ||
| 129 | - What character to use for bulleted lists | ||
| 130 | bullet_char: '*' | ||
| 131 | _help_enum_char: | ||
| 132 | - What character to use as punctuation after numerals in an | ||
| 133 | - enumerated list | ||
| 134 | enum_char: . | ||
| 135 | _help_first_comment_is_literal: | ||
| 136 | - If comment markup is enabled, don't reflow the first comment | ||
| 137 | - block in each listfile. Use this to preserve formatting of | ||
| 138 | - your copyright/license statements. | ||
| 139 | first_comment_is_literal: false | ||
| 140 | _help_literal_comment_pattern: | ||
| 141 | - If comment markup is enabled, don't reflow any comment block | ||
| 142 | - which matches this (regex) pattern. Default is `None` | ||
| 143 | - (disabled). | ||
| 144 | literal_comment_pattern: null | ||
| 145 | _help_fence_pattern: | ||
| 146 | - Regular expression to match preformat fences in comments | ||
| 147 | - default= ``r'^\s*([`~]{3}[`~]*)(.*)$'`` | ||
| 148 | fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$ | ||
| 149 | _help_ruler_pattern: | ||
| 150 | - Regular expression to match rulers in comments default= | ||
| 151 | - '``r''^\s*[^\w\s]{3}.*[^\w\s]{3}$''``' | ||
| 152 | ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$ | ||
| 153 | _help_explicit_trailing_pattern: | ||
| 154 | - If a comment line matches starts with this pattern then it | ||
| 155 | - is explicitly a trailing comment for the preceding argument. | ||
| 156 | - Default is '#<' | ||
| 157 | explicit_trailing_pattern: '#<' | ||
| 158 | _help_hashruler_min_length: | ||
| 159 | - If a comment line starts with at least this many consecutive | ||
| 160 | - hash characters, then don't lstrip() them off. This allows | ||
| 161 | - for lazy hash rulers where the first hash char is not | ||
| 162 | - separated by space | ||
| 163 | hashruler_min_length: 10 | ||
| 164 | _help_canonicalize_hashrulers: | ||
| 165 | - If true, then insert a space between the first hash char and | ||
| 166 | - remaining hash chars in a hash ruler, and normalize its | ||
| 167 | - length to fill the column | ||
| 168 | canonicalize_hashrulers: true | ||
| 169 | _help_enable_markup: | ||
| 170 | - enable comment markup parsing and reflow | ||
| 171 | enable_markup: true | ||
| 172 | _help_lint: Options affecting the linter | ||
| 173 | lint: | ||
| 174 | _help_disabled_codes: | ||
| 175 | - a list of lint codes to disable | ||
| 176 | disabled_codes: [] | ||
| 177 | _help_function_pattern: | ||
| 178 | - regular expression pattern describing valid function names | ||
| 179 | function_pattern: '[0-9a-z_]+' | ||
| 180 | _help_macro_pattern: | ||
| 181 | - regular expression pattern describing valid macro names | ||
| 182 | macro_pattern: '[0-9A-Z_]+' | ||
| 183 | _help_global_var_pattern: | ||
| 184 | - regular expression pattern describing valid names for | ||
| 185 | - variables with global (cache) scope | ||
| 186 | global_var_pattern: '[A-Z][0-9A-Z_]+' | ||
| 187 | _help_internal_var_pattern: | ||
| 188 | - regular expression pattern describing valid names for | ||
| 189 | - variables with global scope (but internal semantic) | ||
| 190 | internal_var_pattern: _[A-Z][0-9A-Z_]+ | ||
| 191 | _help_local_var_pattern: | ||
| 192 | - regular expression pattern describing valid names for | ||
| 193 | - variables with local scope | ||
| 194 | local_var_pattern: '[a-z][a-z0-9_]+' | ||
| 195 | _help_private_var_pattern: | ||
| 196 | - regular expression pattern describing valid names for | ||
| 197 | - privatedirectory variables | ||
| 198 | private_var_pattern: _[0-9a-z_]+ | ||
| 199 | _help_public_var_pattern: | ||
| 200 | - regular expression pattern describing valid names for public | ||
| 201 | - directory variables | ||
| 202 | public_var_pattern: '[A-Z][0-9A-Z_]+' | ||
| 203 | _help_argument_var_pattern: | ||
| 204 | - regular expression pattern describing valid names for | ||
| 205 | - function/macro arguments and loop variables. | ||
| 206 | argument_var_pattern: '[a-z][a-z0-9_]+' | ||
| 207 | _help_keyword_pattern: | ||
| 208 | - regular expression pattern describing valid names for | ||
| 209 | - keywords used in functions or macros | ||
| 210 | keyword_pattern: '[A-Z][0-9A-Z_]+' | ||
| 211 | _help_max_conditionals_custom_parser: | ||
| 212 | - In the heuristic for C0201, how many conditionals to match | ||
| 213 | - within a loop in before considering the loop a parser. | ||
| 214 | max_conditionals_custom_parser: 2 | ||
| 215 | _help_min_statement_spacing: | ||
| 216 | - Require at least this many newlines between statements | ||
| 217 | min_statement_spacing: 1 | ||
| 218 | _help_max_statement_spacing: | ||
| 219 | - Require no more than this many newlines between statements | ||
| 220 | max_statement_spacing: 2 | ||
| 221 | max_returns: 6 | ||
| 222 | max_branches: 12 | ||
| 223 | max_arguments: 5 | ||
| 224 | max_localvars: 15 | ||
| 225 | max_statements: 50 | ||
| 226 | _help_encode: Options affecting file encoding | ||
| 227 | encode: | ||
| 228 | _help_emit_byteorder_mark: | ||
| 229 | - If true, emit the unicode byte-order mark (BOM) at the start | ||
| 230 | - of the file | ||
| 231 | emit_byteorder_mark: false | ||
| 232 | _help_input_encoding: | ||
| 233 | - Specify the encoding of the input file. Defaults to utf-8 | ||
| 234 | input_encoding: utf-8 | ||
| 235 | _help_output_encoding: | ||
| 236 | - Specify the encoding of the output file. Defaults to utf-8. | ||
| 237 | - Note that cmake only claims to support utf-8 so be careful | ||
| 238 | - when using anything else | ||
| 239 | output_encoding: utf-8 | ||
| 240 | _help_misc: Miscellaneous configurations options. | ||
| 241 | misc: | ||
| 242 | _help_per_command: | ||
| 243 | - A dictionary containing any per-command configuration | ||
| 244 | - overrides. Currently only `command_case` is supported. | ||
| 245 | per_command: {} | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ce9419..7054091 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -1,31 +1,31 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.12) | 1 | cmake_minimum_required(VERSION 3.12) |
| 2 | 2 | ||
| 3 | project(zlib | 3 | project( |
| 4 | zlib | ||
| 4 | LANGUAGES C | 5 | LANGUAGES C |
| 5 | VERSION 1.3.1.1 | 6 | VERSION 1.4.1.1 |
| 6 | HOMEPAGE_URL "https://zlib.net/" | 7 | HOMEPAGE_URL "https://zlib.net/" |
| 7 | DESCRIPTION "a general-purpose lossless data-compression library") | 8 | DESCRIPTION "a general-purpose lossless data-compression library") |
| 8 | 9 | ||
| 9 | #============================================================================ | 10 | # ============================================================================ |
| 10 | # CPack | 11 | # CPack |
| 11 | #============================================================================ | 12 | # ============================================================================ |
| 12 | set(CPACK_PACKAGE_VENDOR "zlib-Project") | 13 | set(CPACK_PACKAGE_VENDOR "zlib-Project") |
| 13 | set(CPACK_PACKAGE_DESCRIPTION_FILE ${zlib_SOURCE_DIR}/README) | 14 | set(CPACK_PACKAGE_DESCRIPTION_FILE ${zlib_SOURCE_DIR}/README) |
| 14 | set(CPACK_RESOURCE_FILE_LICENSE ${zlib_SOURCE_DIR}/LICENSE) | 15 | set(CPACK_RESOURCE_FILE_LICENSE ${zlib_SOURCE_DIR}/LICENSE) |
| 15 | set(CPACK_RESOURCE_FILE_README ${zlib_SOURCE_DIR}/README) | 16 | set(CPACK_RESOURCE_FILE_README ${zlib_SOURCE_DIR}/README) |
| 16 | 17 | ||
| 17 | #============================================================================ | 18 | # ============================================================================ |
| 18 | # configuration | 19 | # configuration |
| 19 | #============================================================================ | 20 | # ============================================================================ |
| 20 | 21 | ||
| 21 | option(ZLIB_BUILD_TESTING "Enable Zlib Examples as tests" ON) | 22 | option(ZLIB_BUILD_TESTING "Enable Zlib Examples as tests" ON) |
| 22 | option(ZLIB_BUILD_SHARED "Enable building zlib shared library" ON) | 23 | option(ZLIB_BUILD_SHARED "Enable building zlib shared library" ON) |
| 23 | option(ZLIB_BUILD_STATIC "Enable building zlib static library" ON) | 24 | option(ZLIB_BUILD_STATIC "Enable building zlib static library" ON) |
| 24 | option(ZLIB_BUILD_MINIZIP "Enable building libminizip contrib library" OFF) | 25 | option(ZLIB_BUILD_MINIZIP "Enable building libminizip contrib library" OFF) |
| 25 | option(ZLIB_INSTALL "Enable installation of zlib" ON) | 26 | option(ZLIB_INSTALL "Enable installation of zlib" ON) |
| 26 | option(ZLIB_PREFIX | 27 | option(ZLIB_PREFIX "prefix for all types and library functions, see zconf.h.in" |
| 27 | "prefix for all types and library functions, see zconf.h.in" | 28 | OFF) |
| 28 | OFF) | ||
| 29 | mark_as_advanced(ZLIB_PREFIX) | 29 | mark_as_advanced(ZLIB_PREFIX) |
| 30 | 30 | ||
| 31 | if(WIN32) | 31 | if(WIN32) |
| @@ -70,7 +70,9 @@ if(NOT ZLIB_CONF_WRITTEN) | |||
| 70 | endforeach(item IN LISTS ${ZCONF_CONTENT}) | 70 | endforeach(item IN LISTS ${ZCONF_CONTENT}) |
| 71 | 71 | ||
| 72 | file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT}) | 72 | file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT}) |
| 73 | set(ZLIB_CONF_WRITTEN TRUE CACHE BOOL "zconf.h.cmakein was created") | 73 | set(ZLIB_CONF_WRITTEN |
| 74 | TRUE | ||
| 75 | CACHE BOOL "zconf.h.cmakein was created") | ||
| 74 | mark_as_advanced(ZLIB_CONF_WRITTEN) | 76 | mark_as_advanced(ZLIB_CONF_WRITTEN) |
| 75 | endif(NOT ZLIB_CONF_WRITTEN) | 77 | endif(NOT ZLIB_CONF_WRITTEN) |
| 76 | 78 | ||
| @@ -115,19 +117,15 @@ check_c_source_compiles( | |||
| 115 | 117 | ||
| 116 | unset(CMAKE_COMPILE_FLAGS) | 118 | unset(CMAKE_COMPILE_FLAGS) |
| 117 | set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc) | 119 | set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc) |
| 118 | configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein | 120 | configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY) |
| 119 | ${ZLIB_PC} @ONLY) | 121 | configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein ${zlib_BINARY_DIR}/zconf.h) |
| 120 | configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein | ||
| 121 | ${zlib_BINARY_DIR}/zconf.h) | ||
| 122 | include_directories(${zlib_BINARY_DIR} ${zlib_SOURCE_DIR}) | 122 | include_directories(${zlib_BINARY_DIR} ${zlib_SOURCE_DIR}) |
| 123 | 123 | ||
| 124 | #============================================================================ | 124 | # ============================================================================ |
| 125 | # zlib | 125 | # zlib |
| 126 | #============================================================================ | 126 | # ============================================================================ |
| 127 | 127 | ||
| 128 | set(ZLIB_PUBLIC_HDRS | 128 | set(ZLIB_PUBLIC_HDRS ${zlib_BINARY_DIR}/zconf.h zlib.h) |
| 129 | ${zlib_BINARY_DIR}/zconf.h | ||
| 130 | zlib.h) | ||
| 131 | 129 | ||
| 132 | set(ZLIB_PRIVATE_HDRS | 130 | set(ZLIB_PRIVATE_HDRS |
| 133 | crc32.h | 131 | crc32.h |
| @@ -157,8 +155,10 @@ set(ZLIB_SRCS | |||
| 157 | uncompr.c | 155 | uncompr.c |
| 158 | zutil.c) | 156 | zutil.c) |
| 159 | 157 | ||
| 160 | set_source_files_properties(win32/zlib1.rc PROPERTIES | 158 | set_source_files_properties( |
| 161 | COMPILE_FLAGS $<$<STREQUAL:${CMAKE_RC_OUTPUT_EXTENSION},.obj>:-DGCC_WINDRES>) | 159 | win32/zlib1.rc |
| 160 | PROPERTIES COMPILE_FLAGS | ||
| 161 | $<$<STREQUAL:${CMAKE_RC_OUTPUT_EXTENSION},.obj>:-DGCC_WINDRES>) | ||
| 162 | 162 | ||
| 163 | if(WIN32) | 163 | if(WIN32) |
| 164 | set(zlib_static_suffix "s") | 164 | set(zlib_static_suffix "s") |
| @@ -166,116 +166,126 @@ if(WIN32) | |||
| 166 | endif(WIN32) | 166 | endif(WIN32) |
| 167 | 167 | ||
| 168 | if(ZLIB_BUILD_SHARED) | 168 | if(ZLIB_BUILD_SHARED) |
| 169 | add_library(zlib SHARED | 169 | add_library( |
| 170 | ${ZLIB_SRCS} | 170 | zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS} |
| 171 | ${ZLIB_PUBLIC_HDRS} | 171 | $<$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>:win32/zlib1.rc>) |
| 172 | ${ZLIB_PRIVATE_HDRS} | ||
| 173 | $<$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>:win32/zlib1.rc>) | ||
| 174 | add_library(ZLIB::ZLIB ALIAS zlib) | 172 | add_library(ZLIB::ZLIB ALIAS zlib) |
| 175 | target_include_directories(zlib PUBLIC | 173 | target_include_directories( |
| 176 | $<BUILD_INTERFACE:${zlib_BINARY_DIR}> | 174 | zlib |
| 177 | $<BUILD_INTERFACE:${zlib_SOURCE_DIR}> | 175 | PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}> |
| 178 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | 176 | $<BUILD_INTERFACE:${zlib_SOURCE_DIR}> |
| 179 | target_compile_definitions(zlib | 177 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) |
| 180 | PRIVATE | 178 | target_compile_definitions( |
| 181 | $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO> | 179 | zlib |
| 182 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN> | 180 | PRIVATE $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO> |
| 183 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE> | 181 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN> |
| 184 | $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE> | 182 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE> |
| 185 | PUBLIC | 183 | $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE> |
| 186 | $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>) | 184 | PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>) |
| 187 | set(INSTALL_VERSION ${zlib_VERSION}) | 185 | set(INSTALL_VERSION ${zlib_VERSION}) |
| 188 | 186 | ||
| 189 | if(NOT CYGWIN) | 187 | if(NOT CYGWIN) |
| 190 | set_target_properties(zlib PROPERTIES | 188 | set_target_properties(zlib PROPERTIES SOVERSION ${zlib_VERSION_MAJOR} |
| 191 | SOVERSION ${zlib_VERSION_MAJOR} | 189 | VERSION ${INSTALL_VERSION}) |
| 192 | VERSION ${INSTALL_VERSION}) | ||
| 193 | endif(NOT CYGWIN) | 190 | endif(NOT CYGWIN) |
| 194 | 191 | ||
| 195 | set_target_properties(zlib PROPERTIES | 192 | set_target_properties( |
| 196 | DEFINE_SYMBOL ZLIB_DLL | 193 | zlib |
| 197 | EXPORT_NAME ZLIB | 194 | PROPERTIES DEFINE_SYMBOL ZLIB_DLL |
| 198 | OUTPUT_NAME z) | 195 | EXPORT_NAME ZLIB |
| 199 | if(UNIX AND NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX)) | 196 | OUTPUT_NAME z) |
| 197 | if(UNIX | ||
| 198 | AND NOT APPLE | ||
| 199 | AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX)) | ||
| 200 | # On unix-like platforms the library is almost always called libz | 200 | # On unix-like platforms the library is almost always called libz |
| 201 | set_target_properties(zlib PROPERTIES | 201 | set_target_properties( |
| 202 | LINK_FLAGS "-Wl,--version-script,\"${zlib_SOURCE_DIR}/zlib.map\"") | 202 | zlib |
| 203 | endif(UNIX AND NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX)) | 203 | PROPERTIES LINK_FLAGS |
| 204 | "-Wl,--version-script,\"${zlib_SOURCE_DIR}/zlib.map\"") | ||
| 205 | endif( | ||
| 206 | UNIX | ||
| 207 | AND NOT APPLE | ||
| 208 | AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX)) | ||
| 204 | endif(ZLIB_BUILD_SHARED) | 209 | endif(ZLIB_BUILD_SHARED) |
| 205 | 210 | ||
| 206 | if(ZLIB_BUILD_STATIC) | 211 | if(ZLIB_BUILD_STATIC) |
| 207 | add_library(zlibstatic STATIC | 212 | add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} |
| 208 | ${ZLIB_SRCS} | 213 | ${ZLIB_PRIVATE_HDRS}) |
| 209 | ${ZLIB_PUBLIC_HDRS} | ||
| 210 | ${ZLIB_PRIVATE_HDRS}) | ||
| 211 | add_library(ZLIB::ZLIBSTATIC ALIAS zlibstatic) | 214 | add_library(ZLIB::ZLIBSTATIC ALIAS zlibstatic) |
| 212 | target_include_directories(zlibstatic PUBLIC | 215 | target_include_directories( |
| 213 | $<BUILD_INTERFACE:${zlib_BINARY_DIR}> | 216 | zlibstatic |
| 214 | $<BUILD_INTERFACE:${zlib_SOURCE_DIR}> | 217 | PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}> |
| 215 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | 218 | $<BUILD_INTERFACE:${zlib_SOURCE_DIR}> |
| 216 | target_compile_definitions(zlibstatic | 219 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) |
| 217 | PRIVATE | 220 | target_compile_definitions( |
| 218 | $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO> | 221 | zlibstatic |
| 219 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN> | 222 | PRIVATE $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO> |
| 220 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE> | 223 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN> |
| 221 | $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE> | 224 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE> |
| 222 | PUBLIC | 225 | $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE> |
| 223 | $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>) | 226 | PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>) |
| 224 | set_target_properties(zlibstatic PROPERTIES | 227 | set_target_properties( |
| 225 | EXPORT_NAME ZLIBSTATIC | 228 | zlibstatic PROPERTIES EXPORT_NAME ZLIBSTATIC OUTPUT_NAME |
| 226 | OUTPUT_NAME z${zlib_static_suffix}) | 229 | z${zlib_static_suffix}) |
| 227 | endif(ZLIB_BUILD_STATIC) | 230 | endif(ZLIB_BUILD_STATIC) |
| 228 | 231 | ||
| 229 | if(ZLIB_INSTALL) | 232 | if(ZLIB_INSTALL) |
| 230 | if(ZLIB_BUILD_SHARED) | 233 | if(ZLIB_BUILD_SHARED) |
| 231 | install(TARGETS zlib | 234 | install( |
| 235 | TARGETS zlib | ||
| 232 | COMPONENT Runtime | 236 | COMPONENT Runtime |
| 233 | EXPORT zlibSharedExport | 237 | EXPORT zlibSharedExport |
| 234 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | 238 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" |
| 235 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | 239 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
| 236 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") | 240 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") |
| 237 | install(EXPORT zlibSharedExport | 241 | install( |
| 238 | FILE ZLIB-shared.cmake | 242 | EXPORT zlibSharedExport |
| 239 | NAMESPACE ZLIB:: | 243 | FILE ZLIB-shared.cmake |
| 240 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) | 244 | NAMESPACE ZLIB:: |
| 245 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) | ||
| 241 | if(ZLIB_INSTALL_COMPAT_DLL) | 246 | if(ZLIB_INSTALL_COMPAT_DLL) |
| 242 | install(FILES $<TARGET_FILE:zlib> | 247 | install( |
| 248 | FILES $<TARGET_FILE:zlib> | ||
| 243 | COMPONENT Runtime | 249 | COMPONENT Runtime |
| 244 | RENAME zlib1.dll | 250 | RENAME zlib1.dll |
| 245 | DESTINATION "${CMAKE_INSTALL_BINDIR}") | 251 | DESTINATION "${CMAKE_INSTALL_BINDIR}") |
| 246 | endif(ZLIB_INSTALL_COMPAT_DLL) | 252 | endif(ZLIB_INSTALL_COMPAT_DLL) |
| 247 | 253 | ||
| 248 | if(MSVC) | 254 | if(MSVC) |
| 249 | install(FILES $<TARGET_PDB_FILE:zlib> | 255 | install( |
| 256 | FILES $<TARGET_PDB_FILE:zlib> | ||
| 250 | COMPONENT Runtime | 257 | COMPONENT Runtime |
| 251 | DESTINATION ${CMAKE_INSTALL_BINDIR} | 258 | DESTINATION ${CMAKE_INSTALL_BINDIR} |
| 252 | CONFIGURATIONS Debug OR RelWithDebInfo | 259 | CONFIGURATIONS Debug OR RelWithDebInfo |
| 253 | OPTIONAL | 260 | OPTIONAL) |
| 254 | ) | ||
| 255 | endif(MSVC) | 261 | endif(MSVC) |
| 256 | endif(ZLIB_BUILD_SHARED) | 262 | endif(ZLIB_BUILD_SHARED) |
| 257 | 263 | ||
| 258 | if(ZLIB_BUILD_STATIC) | 264 | if(ZLIB_BUILD_STATIC) |
| 259 | install(TARGETS zlibstatic | 265 | install( |
| 266 | TARGETS zlibstatic | ||
| 260 | COMPONENT Development | 267 | COMPONENT Development |
| 261 | EXPORT zlibStaticExport | 268 | EXPORT zlibStaticExport |
| 262 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | 269 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" |
| 263 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | 270 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
| 264 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") | 271 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") |
| 265 | install(EXPORT zlibStaticExport | 272 | install( |
| 273 | EXPORT zlibStaticExport | ||
| 266 | FILE ZLIB-static.cmake | 274 | FILE ZLIB-static.cmake |
| 267 | NAMESPACE ZLIB:: | 275 | NAMESPACE ZLIB:: |
| 268 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) | 276 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) |
| 269 | 277 | ||
| 270 | if(ZLIB_INSTALL_COMPAT_DLL AND MINGW) | 278 | if(ZLIB_INSTALL_COMPAT_DLL AND MINGW) |
| 271 | install(FILES $<TARGET_FILE:zlibstatic> | 279 | install( |
| 280 | FILES $<TARGET_FILE:zlibstatic> | ||
| 272 | COMPONENT Development | 281 | COMPONENT Development |
| 273 | RENAME libz.dll.a | 282 | RENAME libz.dll.a |
| 274 | DESTINATION "${CMAKE_INSTALL_LIBDIR}") | 283 | DESTINATION "${CMAKE_INSTALL_LIBDIR}") |
| 275 | endif(ZLIB_INSTALL_COMPAT_DLL AND MINGW) | 284 | endif(ZLIB_INSTALL_COMPAT_DLL AND MINGW) |
| 276 | endif(ZLIB_BUILD_STATIC) | 285 | endif(ZLIB_BUILD_STATIC) |
| 277 | 286 | ||
| 278 | configure_package_config_file(${zlib_SOURCE_DIR}/zlibConfig.cmake.in | 287 | configure_package_config_file( |
| 288 | ${zlib_SOURCE_DIR}/zlibConfig.cmake.in | ||
| 279 | ${zlib_BINARY_DIR}/ZLIBConfig.cmake | 289 | ${zlib_BINARY_DIR}/ZLIBConfig.cmake |
| 280 | INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) | 290 | INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) |
| 281 | 291 | ||
| @@ -284,34 +294,36 @@ if(ZLIB_INSTALL) | |||
| 284 | VERSION "${zlib_VERSION}" | 294 | VERSION "${zlib_VERSION}" |
| 285 | COMPATIBILITY AnyNewerVersion) | 295 | COMPATIBILITY AnyNewerVersion) |
| 286 | 296 | ||
| 287 | install(FILES | 297 | install(FILES ${zlib_BINARY_DIR}/ZLIBConfig.cmake |
| 288 | ${zlib_BINARY_DIR}/ZLIBConfig.cmake | 298 | ${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake |
| 289 | ${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake | 299 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) |
| 290 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) | 300 | install( |
| 291 | install(FILES ${ZLIB_PUBLIC_HDRS} | 301 | FILES ${ZLIB_PUBLIC_HDRS} |
| 292 | COMPONENT Development | 302 | COMPONENT Development |
| 293 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") | 303 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") |
| 294 | install(FILES zlib.3 | 304 | install( |
| 295 | COMPONENT Docs | 305 | FILES zlib.3 |
| 296 | DESTINATION "${CMAKE_INSTALL_MANDIR}/man3") | 306 | COMPONENT Docs |
| 297 | install(FILES | 307 | DESTINATION "${CMAKE_INSTALL_MANDIR}/man3") |
| 298 | LICENSE | 308 | install( |
| 299 | doc/algorithm.txt | 309 | FILES LICENSE |
| 300 | doc/crc-doc.1.0.pdf | 310 | doc/algorithm.txt |
| 301 | doc/rfc1950.txt | 311 | doc/crc-doc.1.0.pdf |
| 302 | doc/rfc1951.txt | 312 | doc/rfc1950.txt |
| 303 | doc/rfc1952.txt | 313 | doc/rfc1951.txt |
| 304 | doc/txtvsbin.txt | 314 | doc/rfc1952.txt |
| 305 | COMPONENT Docs | 315 | doc/txtvsbin.txt |
| 306 | DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib") | 316 | COMPONENT Docs |
| 307 | install(FILES ${ZLIB_PC} | 317 | DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib") |
| 308 | COMPONENT Development | 318 | install( |
| 309 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") | 319 | FILES ${ZLIB_PC} |
| 320 | COMPONENT Development | ||
| 321 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") | ||
| 310 | endif(ZLIB_INSTALL) | 322 | endif(ZLIB_INSTALL) |
| 311 | 323 | ||
| 312 | #============================================================================ | 324 | # ============================================================================ |
| 313 | # Tests | 325 | # Tests |
| 314 | #============================================================================ | 326 | # ============================================================================ |
| 315 | if(ZLIB_BUILD_TESTING) | 327 | if(ZLIB_BUILD_TESTING) |
| 316 | enable_testing() | 328 | enable_testing() |
| 317 | add_subdirectory(test) | 329 | add_subdirectory(test) |
diff --git a/contrib/minizip/CMakeLists.txt b/contrib/minizip/CMakeLists.txt index fd43e82..f252002 100644 --- a/contrib/minizip/CMakeLists.txt +++ b/contrib/minizip/CMakeLists.txt | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.12) | 1 | cmake_minimum_required(VERSION 3.12) |
| 2 | 2 | ||
| 3 | project(minizip | 3 | project( |
| 4 | minizip | ||
| 4 | VERSION 1.0.0 | 5 | VERSION 1.0.0 |
| 5 | LANGUAGES C | 6 | LANGUAGES C |
| 6 | DESCRIPTION "A library for creating zipfiles based in zlib" | 7 | DESCRIPTION "A library for creating zipfiles based in zlib" |
| @@ -11,17 +12,17 @@ if(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW) | |||
| 11 | return() | 12 | return() |
| 12 | endif(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW) | 13 | endif(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW) |
| 13 | 14 | ||
| 14 | #============================================================================ | 15 | # ============================================================================ |
| 15 | # CPack | 16 | # CPack |
| 16 | #============================================================================ | 17 | # ============================================================================ |
| 17 | set(CPACK_PACKAGE_VENDOR "zlib-Project") | 18 | set(CPACK_PACKAGE_VENDOR "zlib-Project") |
| 18 | set(CPACK_PACKAGE_DESCRIPTION_FILE ${minizip_SOURCE_DIR}/MiniZip64_info.txt) | 19 | set(CPACK_PACKAGE_DESCRIPTION_FILE ${minizip_SOURCE_DIR}/MiniZip64_info.txt) |
| 19 | set(CPACK_RESOURCE_FILE_LICENSE ${minizip_SOURCE_DIR}/../../LICENSE) | 20 | set(CPACK_RESOURCE_FILE_LICENSE ${minizip_SOURCE_DIR}/../../LICENSE) |
| 20 | set(CPACK_RESOURCE_FILE_README ${minizip_SOURCE_DIR}/MiniZip64_info.txt) | 21 | set(CPACK_RESOURCE_FILE_README ${minizip_SOURCE_DIR}/MiniZip64_info.txt) |
| 21 | 22 | ||
| 22 | #============================================================================ | 23 | # ============================================================================ |
| 23 | # configuration | 24 | # configuration |
| 24 | #============================================================================ | 25 | # ============================================================================ |
| 25 | option(MINIZIP_BUILD_SHARED "Enable building minizip shared library" ON) | 26 | option(MINIZIP_BUILD_SHARED "Enable building minizip shared library" ON) |
| 26 | option(MINIZIP_BUILD_STATIC "Enable building minizip static library" ON) | 27 | option(MINIZIP_BUILD_STATIC "Enable building minizip static library" ON) |
| 27 | option(MINIZIP_BUILD_TESTING "Enable testing of minizip" ON) | 28 | option(MINIZIP_BUILD_TESTING "Enable testing of minizip" ON) |
| @@ -92,40 +93,17 @@ if(NOT TARGET ZLIB::ZLIB) | |||
| 92 | find_package(ZLIB REQUIRED CONFIG) | 93 | find_package(ZLIB REQUIRED CONFIG) |
| 93 | endif(NOT TARGET ZLIB::ZLIB) | 94 | endif(NOT TARGET ZLIB::ZLIB) |
| 94 | 95 | ||
| 95 | set(LIBMINIZIP_SRCS | 96 | set(LIBMINIZIP_SRCS ioapi.c mztools.c unzip.c zip.c) |
| 96 | ioapi.c | ||
| 97 | mztools.c | ||
| 98 | unzip.c | ||
| 99 | zip.c) | ||
| 100 | 97 | ||
| 101 | set(LIBMINIZIP_HDRS | 98 | set(LIBMINIZIP_HDRS crypt.h ints.h ioapi.h mztools.h unzip.h zip.h) |
| 102 | crypt.h | ||
| 103 | ints.h | ||
| 104 | ioapi.h | ||
| 105 | mztools.h | ||
| 106 | unzip.h | ||
| 107 | zip.h) | ||
| 108 | 99 | ||
| 109 | set(MINIZIP_SRCS | 100 | set(MINIZIP_SRCS ioapi.c $<$<BOOL:${WIN32}>:iowin32.c> minizip.c zip.c) |
| 110 | ioapi.c | ||
| 111 | $<$<BOOL:${WIN32}>:iowin32.c> | ||
| 112 | minizip.c | ||
| 113 | zip.c) | ||
| 114 | 101 | ||
| 115 | set(MINIZIP_HDRS | 102 | set(MINIZIP_HDRS crypt.h ints.h ioapi.h $<$<BOOL:${WIN32}>:iowin32.h> skipset.h |
| 116 | crypt.h | 103 | zip.h) |
| 117 | ints.h | ||
| 118 | ioapi.h | ||
| 119 | $<$<BOOL:${WIN32}>:iowin32.h> | ||
| 120 | skipset.h | ||
| 121 | zip.h) | ||
| 122 | 104 | ||
| 123 | set(MINIUNZIP_SRCS | 105 | set(MINIUNZIP_SRCS ioapi.c $<$<BOOL:${WIN32}>:iowin32.c> miniunz.c unzip.c |
| 124 | ioapi.c | 106 | zip.c) |
| 125 | $<$<BOOL:${WIN32}>:iowin32.c> | ||
| 126 | miniunz.c | ||
| 127 | unzip.c | ||
| 128 | zip.c) | ||
| 129 | 107 | ||
| 130 | set(MINIUNZIP_HDRS | 108 | set(MINIUNZIP_HDRS |
| 131 | crypt.h | 109 | crypt.h |
| @@ -143,261 +121,258 @@ endif(WIN32) | |||
| 143 | 121 | ||
| 144 | if(MINIZIP_BUILD_SHARED) | 122 | if(MINIZIP_BUILD_SHARED) |
| 145 | set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | 123 | set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) |
| 146 | add_library(libminizip SHARED | 124 | add_library(libminizip SHARED ${LIBMINIZIP_SRCS} ${LIBMINIZIP_HDRS}) |
| 147 | ${LIBMINIZIP_SRCS} | ||
| 148 | ${LIBMINIZIP_HDRS}) | ||
| 149 | add_library(MINIZIP::minizip ALIAS libminizip) | 125 | add_library(MINIZIP::minizip ALIAS libminizip) |
| 150 | target_include_directories(libminizip PUBLIC | 126 | target_include_directories( |
| 151 | $<BUILD_INTERFACE:${minizip_SOURCE_DIR}> | 127 | libminizip PUBLIC $<BUILD_INTERFACE:${minizip_SOURCE_DIR}> |
| 152 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | 128 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) |
| 153 | target_compile_definitions(libminizip | 129 | target_compile_definitions( |
| 154 | PRIVATE | 130 | libminizip |
| 155 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> | 131 | PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> |
| 156 | $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1> | 132 | $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1> |
| 157 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN> | 133 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN> |
| 158 | $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1> | 134 | $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1> |
| 159 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1> | 135 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1> |
| 160 | PUBLIC | 136 | PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>) |
| 161 | $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>) | ||
| 162 | 137 | ||
| 163 | if(NOT CYGWIN) | 138 | if(NOT CYGWIN) |
| 164 | set_target_properties(libminizip PROPERTIES | 139 | set_target_properties(libminizip PROPERTIES SOVERSION |
| 165 | SOVERSION ${minizip_VERSION_MAJOR}) | 140 | ${minizip_VERSION_MAJOR}) |
| 166 | endif(NOT CYGWIN) | 141 | endif(NOT CYGWIN) |
| 167 | 142 | ||
| 168 | set_target_properties(libminizip PROPERTIES | 143 | set_target_properties( |
| 169 | EXPORT_NAME minizip | 144 | libminizip |
| 170 | OUTPUT_NAME minizip | 145 | PROPERTIES EXPORT_NAME minizip |
| 171 | VERSIOM ${minizip_VERSION} | 146 | OUTPUT_NAME minizip |
| 172 | SOVERSION ${minizip_VERSION_MAJOR}) | 147 | VERSIOM ${minizip_VERSION} |
| 148 | SOVERSION ${minizip_VERSION_MAJOR}) | ||
| 173 | target_link_libraries(libminizip PUBLIC ZLIB::ZLIB) | 149 | target_link_libraries(libminizip PUBLIC ZLIB::ZLIB) |
| 174 | 150 | ||
| 175 | add_executable(minizip | 151 | add_executable(minizip ${MINIZIP_SRCS} ${MINIZIP_HDRS}) |
| 176 | ${MINIZIP_SRCS} | 152 | set_target_properties(minizip PROPERTIES EXPORT_NAME minizip_executable) |
| 177 | ${MINIZIP_HDRS}) | 153 | target_compile_definitions( |
| 178 | set_target_properties(minizip PROPERTIES | 154 | minizip PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> |
| 179 | EXPORT_NAME minizip_executable) | 155 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>) |
| 180 | target_compile_definitions(minizip | ||
| 181 | PRIVATE | ||
| 182 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> | ||
| 183 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>) | ||
| 184 | target_link_libraries(minizip PRIVATE MINIZIP::minizip) | 156 | target_link_libraries(minizip PRIVATE MINIZIP::minizip) |
| 185 | add_executable(miniunzip | 157 | add_executable(miniunzip ${MINIUNZIP_SRCS} ${MINIUNZIP_HDRS}) |
| 186 | ${MINIUNZIP_SRCS} | 158 | set_target_properties(miniunzip PROPERTIES EXPORT_NAME miniunzip_executable) |
| 187 | ${MINIUNZIP_HDRS}) | 159 | target_compile_definitions( |
| 188 | set_target_properties(miniunzip PROPERTIES | 160 | miniunzip PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> |
| 189 | EXPORT_NAME miniunzip_executable) | 161 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>) |
| 190 | target_compile_definitions(miniunzip | ||
| 191 | PRIVATE | ||
| 192 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> | ||
| 193 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>) | ||
| 194 | target_link_libraries(miniunzip PRIVATE MINIZIP::minizip) | 162 | target_link_libraries(miniunzip PRIVATE MINIZIP::minizip) |
| 195 | endif(MINIZIP_BUILD_SHARED) | 163 | endif(MINIZIP_BUILD_SHARED) |
| 196 | 164 | ||
| 197 | if(MINIZIP_BUILD_STATIC) | 165 | if(MINIZIP_BUILD_STATIC) |
| 198 | add_library(libminizipstatic STATIC | 166 | add_library(libminizipstatic STATIC ${LIBMINIZIP_SRCS} ${LIBMINIZIP_HDRS}) |
| 199 | ${LIBMINIZIP_SRCS} | ||
| 200 | ${LIBMINIZIP_HDRS}) | ||
| 201 | add_library(MINIZIP::minizipstatic ALIAS libminizipstatic) | 167 | add_library(MINIZIP::minizipstatic ALIAS libminizipstatic) |
| 202 | target_include_directories(libminizipstatic PUBLIC | 168 | target_include_directories( |
| 203 | $<BUILD_INTERFACE:${minizip_SOURCE_DIR}> | 169 | libminizipstatic |
| 204 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | 170 | PUBLIC $<BUILD_INTERFACE:${minizip_SOURCE_DIR}> |
| 205 | target_compile_definitions(libminizipstatic | 171 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) |
| 206 | PRIVATE | 172 | target_compile_definitions( |
| 207 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> | 173 | libminizipstatic |
| 208 | $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1> | 174 | PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> |
| 209 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN> | 175 | $<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1> |
| 210 | $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1> | 176 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN> |
| 211 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1> | 177 | $<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1> |
| 212 | PUBLIC | 178 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1> |
| 213 | $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>) | 179 | PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>) |
| 214 | set_target_properties(libminizipstatic PROPERTIES | 180 | set_target_properties( |
| 215 | EXPORT_NAME minizipstatic | 181 | libminizipstatic PROPERTIES EXPORT_NAME minizipstatic |
| 216 | OUTPUT_NAME minizip${minizip_static_suffix}) | 182 | OUTPUT_NAME minizip${minizip_static_suffix}) |
| 217 | 183 | ||
| 218 | if(CYGWIN) | 184 | if(CYGWIN) |
| 219 | set_target_properties(libminizipstatic PROPERTIES | 185 | set_target_properties(libminizipstatic PROPERTIES SUFFIX ".dll.a") |
| 220 | SUFFIX ".dll.a") | ||
| 221 | endif(CYGWIN) | 186 | endif(CYGWIN) |
| 222 | 187 | ||
| 223 | target_link_libraries(libminizipstatic PUBLIC ZLIB::ZLIBSTATIC) | 188 | target_link_libraries(libminizipstatic PUBLIC ZLIB::ZLIBSTATIC) |
| 224 | add_executable(minizipstatic | 189 | add_executable(minizipstatic ${MINIZIP_SRCS} ${MINIZIP_HDRS}) |
| 225 | ${MINIZIP_SRCS} | 190 | set_target_properties(minizipstatic PROPERTIES EXPORT_NAME |
| 226 | ${MINIZIP_HDRS}) | 191 | minizip_static_executable) |
| 227 | set_target_properties(minizipstatic PROPERTIES | 192 | target_compile_definitions( |
| 228 | EXPORT_NAME minizip_static_executable) | 193 | minizipstatic PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> |
| 229 | target_compile_definitions(minizipstatic | 194 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>) |
| 230 | PRIVATE | ||
| 231 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> | ||
| 232 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>) | ||
| 233 | target_link_libraries(minizipstatic PRIVATE MINIZIP::minizipstatic) | 195 | target_link_libraries(minizipstatic PRIVATE MINIZIP::minizipstatic) |
| 234 | add_executable(miniunzipstatic | 196 | add_executable(miniunzipstatic ${MINIUNZIP_SRCS} ${MINIUNZIP_HDRS}) |
| 235 | ${MINIUNZIP_SRCS} | 197 | set_target_properties(miniunzipstatic |
| 236 | ${MINIUNZIP_HDRS}) | 198 | PROPERTIES EXPORT_NAME miniunzip_static_executable) |
| 237 | set_target_properties(miniunzipstatic PROPERTIES | 199 | target_compile_definitions( |
| 238 | EXPORT_NAME miniunzip_static_executable) | 200 | miniunzipstatic PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> |
| 239 | target_compile_definitions(miniunzipstatic | 201 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>) |
| 240 | PRIVATE | ||
| 241 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS> | ||
| 242 | $<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>) | ||
| 243 | target_link_libraries(miniunzipstatic PRIVATE MINIZIP::minizipstatic) | 202 | target_link_libraries(miniunzipstatic PRIVATE MINIZIP::minizipstatic) |
| 244 | endif(MINIZIP_BUILD_STATIC) | 203 | endif(MINIZIP_BUILD_STATIC) |
| 245 | 204 | ||
| 246 | if(MINIZIP_INSTALL) | 205 | if(MINIZIP_INSTALL) |
| 247 | if(MINIZIP_BUILD_SHARED) | 206 | if(MINIZIP_BUILD_SHARED) |
| 248 | install(TARGETS libminizip minizip miniunzip | 207 | install( |
| 208 | TARGETS libminizip minizip miniunzip | ||
| 249 | COMPONENT Runtime | 209 | COMPONENT Runtime |
| 250 | EXPORT minizipSharedExport | 210 | EXPORT minizipSharedExport |
| 251 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | 211 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" |
| 252 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | 212 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
| 253 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") | 213 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") |
| 254 | install(EXPORT minizipSharedExport | 214 | install( |
| 255 | FILE minizip-shared.cmake | 215 | EXPORT minizipSharedExport |
| 256 | NAMESPACE MINIZIP:: | 216 | FILE minizip-shared.cmake |
| 257 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip) | 217 | NAMESPACE MINIZIP:: |
| 218 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip) | ||
| 258 | if(MINIZIP_INSTALL_COMPAT_DLL) | 219 | if(MINIZIP_INSTALL_COMPAT_DLL) |
| 259 | install(FILES $<TARGET_FILE:libminizip> | 220 | install( |
| 221 | FILES $<TARGET_FILE:libminizip> | ||
| 260 | COMPONENT Runtime | 222 | COMPONENT Runtime |
| 261 | RENAME libminizip-${minizip_VERSION_MAJOR}.dll | 223 | RENAME libminizip-${minizip_VERSION_MAJOR}.dll |
| 262 | DESTINATION "${CMAKE_INSTALL_BINDIR}") | 224 | DESTINATION "${CMAKE_INSTALL_BINDIR}") |
| 263 | endif(MINIZIP_INSTALL_COMPAT_DLL) | 225 | endif(MINIZIP_INSTALL_COMPAT_DLL) |
| 264 | 226 | ||
| 265 | if(MSVC) | 227 | if(MSVC) |
| 266 | install(FILES $<TARGET_PDB_FILE:libminizip> | 228 | install( |
| 229 | FILES $<TARGET_PDB_FILE:libminizip> | ||
| 267 | COMPONENT Runtime | 230 | COMPONENT Runtime |
| 268 | DESTINATION ${CMAKE_INSTALL_BINDIR} | 231 | DESTINATION ${CMAKE_INSTALL_BINDIR} |
| 269 | CONFIGURATIONS Debug OR RelWithDebInfo | 232 | CONFIGURATIONS Debug OR RelWithDebInfo |
| 270 | OPTIONAL | 233 | OPTIONAL) |
| 271 | ) | ||
| 272 | endif(MSVC) | 234 | endif(MSVC) |
| 273 | endif(MINIZIP_BUILD_SHARED) | 235 | endif(MINIZIP_BUILD_SHARED) |
| 274 | 236 | ||
| 275 | if(MINIZIP_BUILD_STATIC) | 237 | if(MINIZIP_BUILD_STATIC) |
| 276 | install(TARGETS libminizipstatic | 238 | install( |
| 277 | COMPONENT Development | 239 | TARGETS libminizipstatic |
| 278 | TARGETS minizipstatic miniunzipstatic | 240 | COMPONENT Development |
| 279 | COMPONENT Runtime | 241 | TARGETS minizipstatic miniunzipstatic |
| 242 | COMPONENT Runtime | ||
| 280 | EXPORT minizipStaticExport | 243 | EXPORT minizipStaticExport |
| 281 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | 244 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" |
| 282 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | 245 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" |
| 283 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") | 246 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") |
| 284 | install(EXPORT minizipStaticExport | 247 | install( |
| 285 | FILE minizip-static.cmake | 248 | EXPORT minizipStaticExport |
| 286 | NAMESPACE MINIZIP:: | 249 | FILE minizip-static.cmake |
| 287 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip) | 250 | NAMESPACE MINIZIP:: |
| 251 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip) | ||
| 288 | endif(MINIZIP_BUILD_STATIC) | 252 | endif(MINIZIP_BUILD_STATIC) |
| 289 | 253 | ||
| 290 | configure_package_config_file(${minizip_SOURCE_DIR}/minizipConfig.cmake.in | 254 | configure_package_config_file( |
| 255 | ${minizip_SOURCE_DIR}/minizipConfig.cmake.in | ||
| 291 | ${minizip_BINARY_DIR}/minizipConfig.cmake | 256 | ${minizip_BINARY_DIR}/minizipConfig.cmake |
| 292 | INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip) | 257 | INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip) |
| 293 | write_basic_package_version_file( | 258 | write_basic_package_version_file( |
| 294 | "${minizip_BINARY_DIR}/minizipConfigVersion.cmake" | 259 | "${minizip_BINARY_DIR}/minizipConfigVersion.cmake" |
| 295 | VERSION "${minizip_VERSION}" | 260 | VERSION "${minizip_VERSION}" |
| 296 | COMPATIBILITY AnyNewerVersion) | 261 | COMPATIBILITY AnyNewerVersion) |
| 297 | install(FILES | 262 | install(FILES ${minizip_BINARY_DIR}/minizipConfig.cmake |
| 298 | ${minizip_BINARY_DIR}/minizipConfig.cmake | 263 | ${minizip_BINARY_DIR}/minizipConfigVersion.cmake |
| 299 | ${minizip_BINARY_DIR}/minizipConfigVersion.cmake | 264 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip) |
| 300 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip) | 265 | install( |
| 301 | install(FILES ${LIBMINIZIP_HDRS} | 266 | FILES ${LIBMINIZIP_HDRS} |
| 302 | COMPONENT Development | 267 | COMPONENT Development |
| 303 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") | 268 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") |
| 304 | endif(MINIZIP_INSTALL) | 269 | endif(MINIZIP_INSTALL) |
| 305 | 270 | ||
| 306 | if(MINIZIP_BUILD_TESTING) | 271 | if(MINIZIP_BUILD_TESTING) |
| 307 | enable_testing() | 272 | enable_testing() |
| 308 | 273 | ||
| 309 | if(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll") | 274 | if(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL |
| 310 | add_test(NAME minizip_prepare_shared_zip | 275 | ".dll") |
| 311 | COMMAND ${CMAKE_COMMAND} -DCREATE_SHARED=ON | 276 | add_test( |
| 312 | -P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | 277 | NAME minizip_prepare_shared_zip |
| 278 | COMMAND ${CMAKE_COMMAND} -DCREATE_SHARED=ON -P | ||
| 279 | ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | ||
| 313 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 280 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 314 | add_test(NAME minizip_zipping_test_file_shared | 281 | add_test( |
| 282 | NAME minizip_zipping_test_file_shared | ||
| 315 | COMMAND minizip test_file_shared.zip test_file_shared.txt | 283 | COMMAND minizip test_file_shared.zip test_file_shared.txt |
| 316 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 284 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 317 | add_test(NAME minizip_prepare_shared_unzip | 285 | add_test( |
| 318 | COMMAND ${CMAKE_COMMAND} -DMOVE_SHARED=ON | 286 | NAME minizip_prepare_shared_unzip |
| 319 | -P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | 287 | COMMAND ${CMAKE_COMMAND} -DMOVE_SHARED=ON -P |
| 288 | ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | ||
| 320 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 289 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 321 | add_test(NAME minizip_miniunzipping_test_file_shared.zip | 290 | add_test( |
| 291 | NAME minizip_miniunzipping_test_file_shared.zip | ||
| 322 | COMMAND miniunzip test_file_shared.zip | 292 | COMMAND miniunzip test_file_shared.zip |
| 323 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 293 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 324 | add_test(NAME minizip_compare_shared | 294 | add_test( |
| 325 | COMMAND ${CMAKE_COMMAND} -E compare_files | 295 | NAME minizip_compare_shared |
| 326 | test_file_shared.txt test_file_shared.orig | 296 | COMMAND ${CMAKE_COMMAND} -E compare_files test_file_shared.txt |
| 297 | test_file_shared.orig | ||
| 327 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 298 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 328 | add_test(NAME minizip_clean_shared_zip | 299 | add_test( |
| 329 | COMMAND ${CMAKE_COMMAND} -DDELETE_SHARED=ON | 300 | NAME minizip_clean_shared_zip |
| 330 | -P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | 301 | COMMAND ${CMAKE_COMMAND} -DDELETE_SHARED=ON -P |
| 302 | ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | ||
| 331 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 303 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 332 | set_tests_properties(minizip_prepare_shared_zip | 304 | set_tests_properties(minizip_prepare_shared_zip |
| 333 | PROPERTIES | 305 | PROPERTIES FIXTURES_SETUP prepare_shared) |
| 334 | FIXTURES_SETUP prepare_shared) | 306 | set_tests_properties( |
| 335 | set_tests_properties(minizip_zipping_test_file_shared | 307 | minizip_zipping_test_file_shared |
| 336 | PROPERTIES | 308 | PROPERTIES FIXTURES_REQUIRED prepare_shared FIXTURES_SETUP |
| 337 | FIXTURES_REQUIRED prepare_shared | 309 | zip_shared) |
| 338 | FIXTURES_SETUP zip_shared) | 310 | set_tests_properties( |
| 339 | set_tests_properties(minizip_prepare_shared_unzip | 311 | minizip_prepare_shared_unzip |
| 340 | PROPERTIES | 312 | PROPERTIES FIXTURES_REQUIRED zip_shared FIXTURES_SETUP |
| 341 | FIXTURES_REQUIRED zip_shared | 313 | prepare_unzip_shared) |
| 342 | FIXTURES_SETUP prepare_unzip_shared) | 314 | set_tests_properties( |
| 343 | set_tests_properties(minizip_miniunzipping_test_file_shared.zip | 315 | minizip_miniunzipping_test_file_shared.zip |
| 344 | PROPERTIES | 316 | PROPERTIES FIXTURES_REQUIRED prepare_unzip_shared FIXTURES_SETUP |
| 345 | FIXTURES_REQUIRED prepare_unzip_shared | 317 | prepare_compare_shared) |
| 346 | FIXTURES_SETUP prepare_compare_shared) | 318 | set_tests_properties( |
| 347 | set_tests_properties(minizip_compare_shared | 319 | minizip_compare_shared |
| 348 | PROPERTIES | 320 | PROPERTIES FIXTURES_REQUIRED prepare_compare_shared FIXTURES_SETUP |
| 349 | FIXTURES_REQUIRED prepare_compare_shared | 321 | compared_shared) |
| 350 | FIXTURES_SETUP compared_shared) | ||
| 351 | set_tests_properties(minizip_clean_shared_zip | 322 | set_tests_properties(minizip_clean_shared_zip |
| 352 | PROPERTIES | 323 | PROPERTIES FIXTURES_CLEANUP compared_shared) |
| 353 | FIXTURES_CLEANUP compared_shared) | 324 | endif(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL |
| 354 | endif(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll") | 325 | ".dll") |
| 355 | 326 | ||
| 356 | if(MINIZIP_BUILD_STATIC) | 327 | if(MINIZIP_BUILD_STATIC) |
| 357 | add_test(NAME minizip_prepare_static_zip | 328 | add_test( |
| 358 | COMMAND ${CMAKE_COMMAND} -DCREATE_STATIC=ON | 329 | NAME minizip_prepare_static_zip |
| 359 | -P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | 330 | COMMAND ${CMAKE_COMMAND} -DCREATE_STATIC=ON -P |
| 331 | ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | ||
| 360 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 332 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 361 | add_test(NAME minizip_zipping_test_file_static | 333 | add_test( |
| 334 | NAME minizip_zipping_test_file_static | ||
| 362 | COMMAND minizipstatic test_file_static.zip test_file_static.txt | 335 | COMMAND minizipstatic test_file_static.zip test_file_static.txt |
| 363 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 336 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 364 | add_test(NAME minizip_prepare_static_unzip | 337 | add_test( |
| 365 | COMMAND ${CMAKE_COMMAND} -DMOVE_STATIC=ON | 338 | NAME minizip_prepare_static_unzip |
| 366 | -P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | 339 | COMMAND ${CMAKE_COMMAND} -DMOVE_STATIC=ON -P |
| 340 | ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | ||
| 367 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 341 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 368 | add_test(NAME minizip_miniunzipping_test_file_static.zip | 342 | add_test( |
| 343 | NAME minizip_miniunzipping_test_file_static.zip | ||
| 369 | COMMAND miniunzipstatic test_file_static.zip | 344 | COMMAND miniunzipstatic test_file_static.zip |
| 370 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 345 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 371 | add_test(NAME minizip_compare_static | 346 | add_test( |
| 372 | COMMAND ${CMAKE_COMMAND} -E compare_files | 347 | NAME minizip_compare_static |
| 373 | test_file_static.txt test_file_static.orig | 348 | COMMAND ${CMAKE_COMMAND} -E compare_files test_file_static.txt |
| 349 | test_file_static.orig | ||
| 374 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 350 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 375 | add_test(NAME minizip_clean_static_zip | 351 | add_test( |
| 376 | COMMAND ${CMAKE_COMMAND} -DDELETE_STATIC=ON | 352 | NAME minizip_clean_static_zip |
| 377 | -P ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | 353 | COMMAND ${CMAKE_COMMAND} -DDELETE_STATIC=ON -P |
| 354 | ${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm | ||
| 378 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) | 355 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test) |
| 379 | set_tests_properties(minizip_prepare_static_zip | 356 | set_tests_properties(minizip_prepare_static_zip |
| 380 | PROPERTIES | 357 | PROPERTIES FIXTURES_SETUP prepare_static) |
| 381 | FIXTURES_SETUP prepare_static) | 358 | set_tests_properties( |
| 382 | set_tests_properties(minizip_zipping_test_file_static | 359 | minizip_zipping_test_file_static |
| 383 | PROPERTIES | 360 | PROPERTIES FIXTURES_REQUIRED prepare_static FIXTURES_SETUP |
| 384 | FIXTURES_REQUIRED prepare_static | 361 | zip_static) |
| 385 | FIXTURES_SETUP zip_static) | 362 | set_tests_properties( |
| 386 | set_tests_properties(minizip_prepare_static_unzip | 363 | minizip_prepare_static_unzip |
| 387 | PROPERTIES | 364 | PROPERTIES FIXTURES_REQUIRED zip_static FIXTURES_SETUP |
| 388 | FIXTURES_REQUIRED zip_static | 365 | prepare_unzip_static) |
| 389 | FIXTURES_SETUP prepare_unzip_static) | 366 | set_tests_properties( |
| 390 | set_tests_properties(minizip_miniunzipping_test_file_static.zip | 367 | minizip_miniunzipping_test_file_static.zip |
| 391 | PROPERTIES | 368 | PROPERTIES FIXTURES_REQUIRED prepare_unzip_static FIXTURES_SETUP |
| 392 | FIXTURES_REQUIRED prepare_unzip_static | 369 | prepare_compare_static) |
| 393 | FIXTURES_SETUP prepare_compare_static) | 370 | set_tests_properties( |
| 394 | set_tests_properties(minizip_compare_static | 371 | minizip_compare_static |
| 395 | PROPERTIES | 372 | PROPERTIES FIXTURES_REQUIRED prepare_compare_static FIXTURES_SETUP |
| 396 | FIXTURES_REQUIRED prepare_compare_static | 373 | compared_static) |
| 397 | FIXTURES_SETUP compared_static) | ||
| 398 | set_tests_properties(minizip_clean_static_zip | 374 | set_tests_properties(minizip_clean_static_zip |
| 399 | PROPERTIES | 375 | PROPERTIES FIXTURES_CLEANUP compared_static) |
| 400 | FIXTURES_CLEANUP compared_static) | ||
| 401 | endif(MINIZIP_BUILD_STATIC) | 376 | endif(MINIZIP_BUILD_STATIC) |
| 402 | 377 | ||
| 403 | add_subdirectory(test) | 378 | add_subdirectory(test) |
diff --git a/contrib/minizip/minizipConfig.cmake.in b/contrib/minizip/minizipConfig.cmake.in index 14db08d..5456053 100644 --- a/contrib/minizip/minizipConfig.cmake.in +++ b/contrib/minizip/minizipConfig.cmake.in | |||
| @@ -15,7 +15,7 @@ if(minizip_FIND_COMPONENTS) | |||
| 15 | find_dependency(ZLIB CONFIG COMPONENTS ${minizip_FIND_COMPONENTS}) | 15 | find_dependency(ZLIB CONFIG COMPONENTS ${minizip_FIND_COMPONENTS}) |
| 16 | 16 | ||
| 17 | foreach(_comp ${minizip_FIND_COMPONENTS}) | 17 | foreach(_comp ${minizip_FIND_COMPONENTS}) |
| 18 | if (NOT _comp IN_LIST _MINIZIP_supported_components) | 18 | if(NOT _comp IN_LIST _MINIZIP_supported_components) |
| 19 | set(minizip_FOUND False) | 19 | set(minizip_FOUND False) |
| 20 | set(minizip_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") | 20 | set(minizip_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") |
| 21 | endif(NOT _comp IN_LIST _MINIZIP_supported_components) | 21 | endif(NOT _comp IN_LIST _MINIZIP_supported_components) |
diff --git a/contrib/minizip/test/CMakeLists.txt b/contrib/minizip/test/CMakeLists.txt index 2da5ae1..2f86ee3 100644 --- a/contrib/minizip/test/CMakeLists.txt +++ b/contrib/minizip/test/CMakeLists.txt | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #if we are built from with zlib, use this path's) | 1 | # if we are built from with zlib, use this path's) |
| 2 | if(DEFINED ZLIB_BUILD_SHARED) | 2 | if(DEFINED ZLIB_BUILD_SHARED) |
| 3 | set(WORK_DIR ${zlib_BINARY_DIR}) | 3 | set(WORK_DIR ${zlib_BINARY_DIR}) |
| 4 | set(inst_setup minizip_minizip_install) | 4 | set(inst_setup minizip_minizip_install) |
| @@ -7,31 +7,30 @@ else(DEFINED ZLIB_BUILD_SHARED) | |||
| 7 | set(inst_setup minizip_minizip_install) | 7 | set(inst_setup minizip_minizip_install) |
| 8 | set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}") | 8 | set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}") |
| 9 | 9 | ||
| 10 | add_test(NAME minizip_install | 10 | add_test( |
| 11 | COMMAND ${CMAKE_COMMAND} --install ${minizip_BINARY_DIR} | 11 | NAME minizip_install |
| 12 | --prefix ${CMAKE_CURRENT_BINARY_DIR}/test_install | 12 | COMMAND ${CMAKE_COMMAND} --install ${minizip_BINARY_DIR} --prefix |
| 13 | --config $<CONFIG> | 13 | ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG> |
| 14 | WORKING_DIRECTORY ${minizip_BINARY_DIR}) | 14 | WORKING_DIRECTORY ${minizip_BINARY_DIR}) |
| 15 | 15 | ||
| 16 | set_tests_properties(minizip_install | 16 | set_tests_properties(minizip_install PROPERTIES FIXTURES_SETUP |
| 17 | PROPERTIES | 17 | minizip_install) |
| 18 | FIXTURES_SETUP minizip_install) | ||
| 19 | endif(DEFINED ZLIB_BUILD_SHARED) | 18 | endif(DEFINED ZLIB_BUILD_SHARED) |
| 20 | 19 | ||
| 21 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) | 20 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) |
| 22 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test) | 21 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test) |
| 23 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test) | 22 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test) |
| 24 | 23 | ||
| 25 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in | 24 | configure_file( |
| 26 | ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt | 25 | ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in |
| 27 | @ONLY) | 26 | ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY) |
| 28 | 27 | ||
| 29 | configure_file( | 28 | configure_file( |
| 30 | ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in | 29 | ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in |
| 31 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt | 30 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY) |
| 32 | @ONLY) | ||
| 33 | 31 | ||
| 34 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in | 32 | configure_file( |
| 33 | ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in | ||
| 35 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt | 34 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt |
| 36 | @ONLY) | 35 | @ONLY) |
| 37 | 36 | ||
| @@ -45,83 +44,78 @@ endif(GENERATOR) | |||
| 45 | # | 44 | # |
| 46 | # findpackage_test | 45 | # findpackage_test |
| 47 | # | 46 | # |
| 48 | add_test(NAME minizip_find_package_configure | 47 | add_test( |
| 49 | COMMAND ${CMAKE_COMMAND} | 48 | NAME minizip_find_package_configure |
| 50 | ${PLATFORM} | 49 | COMMAND |
| 50 | ${CMAKE_COMMAND} ${PLATFORM} | ||
| 51 | -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build | 51 | -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build |
| 52 | -DCMAKE_BUILD_TYPE=$<CONFIG> | 52 | -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} |
| 53 | -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | ||
| 54 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | 53 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} |
| 55 | -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install | 54 | -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG} |
| 56 | ${ZLIB_ARG} | 55 | --fresh -G "${CMAKE_GENERATOR}" |
| 57 | --fresh | ||
| 58 | -G "${CMAKE_GENERATOR}" | ||
| 59 | -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) | 56 | -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) |
| 60 | 57 | ||
| 61 | add_test(NAME minizip_find_package_build | 58 | add_test( |
| 62 | COMMAND ${CMAKE_COMMAND} --build . | 59 | NAME minizip_find_package_build |
| 63 | --config $<CONFIG> | 60 | COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG> |
| 64 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build) | 61 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build) |
| 65 | 62 | ||
| 66 | set_tests_properties(minizip_find_package_configure PROPERTIES | 63 | set_tests_properties( |
| 67 | FIXTURES_REQUIRED ${inst_setup} | 64 | minizip_find_package_configure PROPERTIES FIXTURES_REQUIRED ${inst_setup} |
| 68 | FIXTURES_SETUP mzfp_config) | 65 | FIXTURES_SETUP mzfp_config) |
| 69 | 66 | ||
| 70 | set_tests_properties(minizip_find_package_build PROPERTIES | 67 | set_tests_properties(minizip_find_package_build PROPERTIES FIXTURES_REQUIRED |
| 71 | FIXTURES_REQUIRED mzfp_config) | 68 | mzfp_config) |
| 72 | 69 | ||
| 73 | # | 70 | # |
| 74 | # add_subdirectory_test | 71 | # add_subdirectory_test |
| 75 | # | 72 | # |
| 76 | add_test(NAME minizip_add_subdirectory_configure | 73 | add_test( |
| 77 | COMMAND ${CMAKE_COMMAND} | 74 | NAME minizip_add_subdirectory_configure |
| 78 | ${PLATFORM} | 75 | COMMAND |
| 79 | -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build | 76 | ${CMAKE_COMMAND} ${PLATFORM} |
| 80 | -DCMAKE_BUILD_TYPE=$<CONFIG> | 77 | -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build |
| 81 | -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | 78 | -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} |
| 82 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | 79 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} |
| 83 | -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install | 80 | -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG} |
| 84 | ${ZLIB_ARG} | 81 | --fresh -G "${CMAKE_GENERATOR}" |
| 85 | --fresh | 82 | -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test) |
| 86 | -G "${CMAKE_GENERATOR}" | 83 | |
| 87 | -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test) | 84 | add_test( |
| 88 | 85 | NAME minizip_add_subdirectory_build | |
| 89 | add_test(NAME minizip_add_subdirectory_build | 86 | COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG> |
| 90 | COMMAND ${CMAKE_COMMAND} --build . | ||
| 91 | --config $<CONFIG> | ||
| 92 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build) | 87 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build) |
| 93 | 88 | ||
| 94 | set_tests_properties(minizip_add_subdirectory_configure PROPERTIES | 89 | set_tests_properties( |
| 95 | FIXTURES_REQUIRED ${inst_setup} | 90 | minizip_add_subdirectory_configure |
| 96 | FIXTURES_SETUP mzas_config) | 91 | PROPERTIES FIXTURES_REQUIRED ${inst_setup} FIXTURES_SETUP mzas_config) |
| 97 | 92 | ||
| 98 | set_tests_properties(minizip_add_subdirectory_build PROPERTIES | 93 | set_tests_properties(minizip_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED |
| 99 | FIXTURES_REQUIRED mzas_config) | 94 | mzas_config) |
| 100 | 95 | ||
| 101 | # | 96 | # |
| 102 | # add_subdirectory_exclude_test | 97 | # add_subdirectory_exclude_test |
| 103 | # | 98 | # |
| 104 | add_test(NAME minizip_add_subdirectory_exclude_configure | 99 | add_test( |
| 105 | COMMAND ${CMAKE_COMMAND} | 100 | NAME minizip_add_subdirectory_exclude_configure |
| 106 | ${PLATFORM} | 101 | COMMAND |
| 107 | -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build | 102 | ${CMAKE_COMMAND} ${PLATFORM} |
| 108 | -DCMAKE_BUILD_TYPE=$<CONFIG> | 103 | -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build |
| 109 | -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | 104 | -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} |
| 110 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | 105 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} |
| 111 | -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install | 106 | -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG} |
| 112 | ${ZLIB_ARG} | 107 | --fresh -G "${CMAKE_GENERATOR}" |
| 113 | --fresh | 108 | -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test) |
| 114 | -G "${CMAKE_GENERATOR}" | 109 | |
| 115 | -S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test) | 110 | add_test( |
| 116 | 111 | NAME minizip_add_subdirectory_exclude_build | |
| 117 | add_test(NAME minizip_add_subdirectory_exclude_build | 112 | COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG> |
| 118 | COMMAND ${CMAKE_COMMAND} --build . | 113 | WORKING_DIRECTORY |
| 119 | --config $<CONFIG> | 114 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build) |
| 120 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build) | 115 | |
| 121 | 116 | set_tests_properties( | |
| 122 | set_tests_properties(minizip_add_subdirectory_exclude_configure PROPERTIES | 117 | minizip_add_subdirectory_exclude_configure |
| 123 | FIXTURES_REQUIRED ${inst_setup} | 118 | PROPERTIES FIXTURES_REQUIRED ${inst_setup} FIXTURES_SETUP mzasx_config) |
| 124 | FIXTURES_SETUP mzasx_config) | 119 | |
| 125 | 120 | set_tests_properties(minizip_add_subdirectory_exclude_build | |
| 126 | set_tests_properties(minizip_add_subdirectory_exclude_build PROPERTIES | 121 | PROPERTIES FIXTURES_REQUIRED mzasx_config) |
| 127 | FIXTURES_REQUIRED mzasx_config) | ||
diff --git a/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in b/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in index f662cda..8ac16b5 100644 --- a/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in +++ b/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.12) | 1 | cmake_minimum_required(VERSION 3.12) |
| 2 | 2 | ||
| 3 | project(minizip_add_subdirectory_exclude_from_all | 3 | project( |
| 4 | minizip_add_subdirectory_exclude_from_all | ||
| 4 | LANGUAGES C | 5 | LANGUAGES C |
| 5 | VERSION @minizip_VERSION@) | 6 | VERSION @minizip_VERSION@) |
| 6 | 7 | ||
| @@ -9,13 +10,13 @@ option(MINIZIP_BUILD_SHARED "" @MINIZIP_BUILD_SHARED@) | |||
| 9 | option(MINIZIP_BUILD_STATIC "" @MINIZIP_BUILD_STATIC@) | 10 | option(MINIZIP_BUILD_STATIC "" @MINIZIP_BUILD_STATIC@) |
| 10 | option(MINIZIP_ENABLE_BZIP2 "" @MINIZIP_ENABLE_BZIP2@) | 11 | option(MINIZIP_ENABLE_BZIP2 "" @MINIZIP_ENABLE_BZIP2@) |
| 11 | 12 | ||
| 12 | add_subdirectory(@minizip_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/minizip EXCLUDE_FROM_ALL) | 13 | add_subdirectory(@minizip_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/minizip |
| 14 | EXCLUDE_FROM_ALL) | ||
| 13 | 15 | ||
| 14 | set(MINIZIP_SRCS | 16 | set(MINIZIP_SRCS |
| 15 | @minizip_SOURCE_DIR@/ioapi.c | 17 | @minizip_SOURCE_DIR@/ioapi.c |
| 16 | $<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c> | 18 | $<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c> |
| 17 | @minizip_SOURCE_DIR@/minizip.c | 19 | @minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c) |
| 18 | @minizip_SOURCE_DIR@/zip.c) | ||
| 19 | 20 | ||
| 20 | if(MINIZIP_BUILD_SHARED) | 21 | if(MINIZIP_BUILD_SHARED) |
| 21 | add_executable(test_example ${MINIZIP_SRCS}) | 22 | add_executable(test_example ${MINIZIP_SRCS}) |
diff --git a/contrib/minizip/test/add_subdirectory_test.cmake.in b/contrib/minizip/test/add_subdirectory_test.cmake.in index be5c664..9d068fb 100644 --- a/contrib/minizip/test/add_subdirectory_test.cmake.in +++ b/contrib/minizip/test/add_subdirectory_test.cmake.in | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.12) | 1 | cmake_minimum_required(VERSION 3.12) |
| 2 | 2 | ||
| 3 | project(minizip_add_subdirectory_exclude_from_all | 3 | project( |
| 4 | minizip_add_subdirectory_exclude_from_all | ||
| 4 | LANGUAGES C | 5 | LANGUAGES C |
| 5 | VERSION @minizip_VERSION@) | 6 | VERSION @minizip_VERSION@) |
| 6 | 7 | ||
| @@ -14,8 +15,7 @@ add_subdirectory(@minizip_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/minizip) | |||
| 14 | set(MINIZIP_SRCS | 15 | set(MINIZIP_SRCS |
| 15 | @minizip_SOURCE_DIR@/ioapi.c | 16 | @minizip_SOURCE_DIR@/ioapi.c |
| 16 | $<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c> | 17 | $<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c> |
| 17 | @minizip_SOURCE_DIR@/minizip.c | 18 | @minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c) |
| 18 | @minizip_SOURCE_DIR@/zip.c) | ||
| 19 | 19 | ||
| 20 | if(MINIZIP_BUILD_SHARED) | 20 | if(MINIZIP_BUILD_SHARED) |
| 21 | add_executable(test_example ${MINIZIP_SRCS}) | 21 | add_executable(test_example ${MINIZIP_SRCS}) |
diff --git a/contrib/minizip/test/find_package_test.cmake.in b/contrib/minizip/test/find_package_test.cmake.in index b56b559..a2c5fb0 100644 --- a/contrib/minizip/test/find_package_test.cmake.in +++ b/contrib/minizip/test/find_package_test.cmake.in | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.12) | 1 | cmake_minimum_required(VERSION 3.12) |
| 2 | 2 | ||
| 3 | project(minizip_find_package | 3 | project( |
| 4 | minizip_find_package | ||
| 4 | LANGUAGES C | 5 | LANGUAGES C |
| 5 | VERSION @minizip_VERSION@) | 6 | VERSION @minizip_VERSION@) |
| 6 | 7 | ||
| @@ -11,8 +12,7 @@ find_package(minizip ${minizip_VERSION} CONFIG REQUIRED) | |||
| 11 | set(MINIZIP_SRCS | 12 | set(MINIZIP_SRCS |
| 12 | @minizip_SOURCE_DIR@/ioapi.c | 13 | @minizip_SOURCE_DIR@/ioapi.c |
| 13 | $<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c> | 14 | $<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c> |
| 14 | @minizip_SOURCE_DIR@/minizip.c | 15 | @minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c) |
| 15 | @minizip_SOURCE_DIR@/zip.c) | ||
| 16 | 16 | ||
| 17 | if(MINIZIP_BUILD_SHARED) | 17 | if(MINIZIP_BUILD_SHARED) |
| 18 | add_executable(test_example ${MINIZIP_SRCS}) | 18 | add_executable(test_example ${MINIZIP_SRCS}) |
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b9bcdfa..46c07eb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt | |||
| @@ -1,68 +1,78 @@ | |||
| 1 | function (ZLIB_findTestEnv testName) | 1 | function(ZLIB_findTestEnv testName) |
| 2 | set (testEnv "PATH=") | 2 | set(testEnv "PATH=") |
| 3 | 3 | ||
| 4 | if (MSVC OR MINGW) | 4 | if(MSVC OR MINGW) |
| 5 | set (separator "\\\;") | 5 | set(separator "\\\;") |
| 6 | else() | 6 | else() |
| 7 | set (separator ":") | 7 | set(separator ":") |
| 8 | endif() | 8 | endif() |
| 9 | 9 | ||
| 10 | string (APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}") | 10 | string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}") |
| 11 | string (APPEND testEnv "$ENV{PATH}") | 11 | string(APPEND testEnv "$ENV{PATH}") |
| 12 | 12 | ||
| 13 | set_tests_properties (${testName} PROPERTIES | 13 | set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}") |
| 14 | ENVIRONMENT "${testEnv}" | ||
| 15 | ) | ||
| 16 | endfunction() | 14 | endfunction() |
| 17 | 15 | ||
| 18 | if(ZLIB_BUILD_SHARED) | 16 | if(ZLIB_BUILD_SHARED) |
| 19 | add_executable(zlib_example example.c) | 17 | add_executable(zlib_example example.c) |
| 20 | target_link_libraries(zlib_example ZLIB::ZLIB) | 18 | target_link_libraries(zlib_example ZLIB::ZLIB) |
| 21 | add_test(NAME zlib_example | 19 | add_test(NAME zlib_example COMMAND zlib_example) |
| 22 | COMMAND zlib_example) | ||
| 23 | 20 | ||
| 24 | add_executable(minigzip minigzip.c) | 21 | add_executable(minigzip minigzip.c) |
| 25 | target_compile_definitions(minigzip | 22 | target_compile_definitions( |
| 26 | PRIVATE | 23 | minigzip PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) |
| 27 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | ||
| 28 | target_link_libraries(minigzip ZLIB::ZLIB) | 24 | target_link_libraries(minigzip ZLIB::ZLIB) |
| 29 | 25 | ||
| 30 | if (MSVC OR MSYS OR MINGW OR CYGWIN) | 26 | if(MSVC |
| 31 | ZLIB_findTestEnv (zlib_example) | 27 | OR MSYS |
| 32 | endif (MSVC OR MSYS OR MINGW OR CYGWIN) | 28 | OR MINGW |
| 29 | OR CYGWIN) | ||
| 30 | zlib_findtestenv(zlib_example) | ||
| 31 | endif( | ||
| 32 | MSVC | ||
| 33 | OR MSYS | ||
| 34 | OR MINGW | ||
| 35 | OR CYGWIN) | ||
| 33 | 36 | ||
| 34 | if(HAVE_OFF64_T) | 37 | if(HAVE_OFF64_T) |
| 35 | add_executable(zlib_example64 example.c) | 38 | add_executable(zlib_example64 example.c) |
| 36 | target_compile_definitions(zlib_example64 | 39 | target_compile_definitions( |
| 37 | PRIVATE | 40 | zlib_example64 |
| 38 | LARGEFILE64_SOURCE=1 | 41 | PRIVATE LARGEFILE64_SOURCE=1 |
| 39 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | 42 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) |
| 40 | target_link_libraries(zlib_example64 ZLIB::ZLIB) | 43 | target_link_libraries(zlib_example64 ZLIB::ZLIB) |
| 41 | add_test(NAME zlib_example64 | 44 | add_test(NAME zlib_example64 COMMAND zlib_example64) |
| 42 | COMMAND zlib_example64) | 45 | |
| 43 | 46 | if(MSVC | |
| 44 | if (MSVC OR MSYS OR MINGW OR CYGWIN) | 47 | OR MSYS |
| 45 | ZLIB_findTestEnv (zlib_example64) | 48 | OR MINGW |
| 46 | endif (MSVC OR MSYS OR MINGW OR CYGWIN) | 49 | OR CYGWIN) |
| 50 | zlib_findtestenv(zlib_example64) | ||
| 51 | endif( | ||
| 52 | MSVC | ||
| 53 | OR MSYS | ||
| 54 | OR MINGW | ||
| 55 | OR CYGWIN) | ||
| 47 | endif(HAVE_OFF64_T) | 56 | endif(HAVE_OFF64_T) |
| 48 | endif(ZLIB_BUILD_SHARED) | 57 | endif(ZLIB_BUILD_SHARED) |
| 49 | 58 | ||
| 50 | if(ZLIB_BUILD_STATIC) | 59 | if(ZLIB_BUILD_STATIC) |
| 51 | add_executable(zlib_static_example example.c) | 60 | add_executable(zlib_static_example example.c) |
| 52 | target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC) | 61 | target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC) |
| 53 | target_compile_definitions(zlib_static_example | 62 | target_compile_definitions( |
| 54 | PRIVATE | 63 | zlib_static_example |
| 55 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | 64 | PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) |
| 56 | add_test(NAME zlib_static_example | 65 | add_test(NAME zlib_static_example COMMAND zlib_static_example) |
| 57 | COMMAND zlib_static_example) | ||
| 58 | 66 | ||
| 59 | add_executable(static_minigzip minigzip.c) | 67 | add_executable(static_minigzip minigzip.c) |
| 60 | target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC) | 68 | target_link_libraries(static_minigzip ZLIB::ZLIBSTATIC) |
| 61 | 69 | ||
| 62 | if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR | 70 | if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL |
| 63 | ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") | 71 | "Clang") |
| 64 | set(CFLAGS_OLD ${CMAKE_C_FLAGS}) | 72 | set(CFLAGS_OLD ${CMAKE_C_FLAGS}) |
| 65 | set({CMAKE_C_FLAGS "" CACHE STRING "" FORCE) | 73 | set({CMAKE_C_FLAGS |
| 74 | "" | ||
| 75 | CACHE STRING "" FORCE) | ||
| 66 | 76 | ||
| 67 | if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU") | 77 | if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU") |
| 68 | find_program(GCOV_EXECUTABLE gcov) | 78 | find_program(GCOV_EXECUTABLE gcov) |
| @@ -73,7 +83,7 @@ if(ZLIB_BUILD_STATIC) | |||
| 73 | list(APPEND llvm_names llvm-cov) | 83 | list(APPEND llvm_names llvm-cov) |
| 74 | 84 | ||
| 75 | foreach(ver RANGE 11 99) | 85 | foreach(ver RANGE 11 99) |
| 76 | list(APPEND llvm_names llvm-cov-${ver}) | 86 | list(APPEND llvm_names llvm-cov-${ver}) |
| 77 | endforeach(ver RANGE 11 99) | 87 | endforeach(ver RANGE 11 99) |
| 78 | 88 | ||
| 79 | find_program(GCOV_EXECUTABLE NAMES ${llvm_names}) | 89 | find_program(GCOV_EXECUTABLE NAMES ${llvm_names}) |
| @@ -84,57 +94,57 @@ if(ZLIB_BUILD_STATIC) | |||
| 84 | target_link_libraries(infcover ZLIB::ZLIBSTATIC) | 94 | target_link_libraries(infcover ZLIB::ZLIBSTATIC) |
| 85 | target_compile_options(infcover PRIVATE -coverage) | 95 | target_compile_options(infcover PRIVATE -coverage) |
| 86 | target_link_options(infcover PRIVATE -coverage) | 96 | target_link_options(infcover PRIVATE -coverage) |
| 87 | target_compile_definitions(infcover | 97 | target_compile_definitions( |
| 88 | PRIVATE | 98 | infcover PRIVATE $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) |
| 89 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | 99 | add_test(NAME zlib-coverage COMMAND infcover) |
| 90 | add_test (NAME zlib-coverage COMMAND infcover) | 100 | set(INFCOVER_DIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/infcover.dir) |
| 91 | set (INFCOVER_DIR | 101 | add_test( |
| 92 | ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/infcover.dir) | 102 | NAME zlib-coverage-summary |
| 93 | add_test (NAME zlib-coverage-summary | 103 | COMMAND |
| 94 | COMMAND ${GCOV_EXECUTABLE} ${llvm_option} | 104 | ${GCOV_EXECUTABLE} ${llvm_option} |
| 95 | ${CMAKE_CURRENT_SOURCE_DIR}/infcover.c | 105 | ${CMAKE_CURRENT_SOURCE_DIR}/infcover.c -o |
| 96 | -o ${INFCOVER_DIR}/infcover.c.gcda) | 106 | ${INFCOVER_DIR}/infcover.c.gcda) |
| 97 | set_tests_properties(zlib-coverage-summary PROPERTIES DEPENDS zlib-coverage) | 107 | set_tests_properties(zlib-coverage-summary PROPERTIES DEPENDS |
| 98 | set({CMAKE_C_FLAGS ${CFLAGS_OLD} CACHE STRING "" FORCE) | 108 | zlib-coverage) |
| 99 | endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR | 109 | set({CMAKE_C_FLAGS |
| 100 | ${CMAKE_C_COMPILER_ID} STREQUAL "Clang") | 110 | ${CFLAGS_OLD} |
| 111 | CACHE STRING "" FORCE) | ||
| 112 | endif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} | ||
| 113 | STREQUAL "Clang") | ||
| 101 | 114 | ||
| 102 | if(HAVE_OFF64_T) | 115 | if(HAVE_OFF64_T) |
| 103 | add_executable(zlib_static_example64 example.c) | 116 | add_executable(zlib_static_example64 example.c) |
| 104 | target_compile_definitions(zlib_static_example64 | 117 | target_compile_definitions( |
| 105 | PRIVATE | 118 | zlib_static_example64 |
| 106 | LARGEFILE64_SOURCE=1 | 119 | PRIVATE LARGEFILE64_SOURCE=1 |
| 107 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | 120 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) |
| 108 | target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC) | 121 | target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC) |
| 109 | add_test(NAME zlib_static_example64 | 122 | add_test(NAME zlib_static_example64 COMMAND zlib_static_example64) |
| 110 | COMMAND zlib_static_example64) | ||
| 111 | endif(HAVE_OFF64_T) | 123 | endif(HAVE_OFF64_T) |
| 112 | endif(ZLIB_BUILD_STATIC) | 124 | endif(ZLIB_BUILD_STATIC) |
| 113 | 125 | ||
| 114 | add_test(NAME zlib_install | 126 | add_test( |
| 115 | COMMAND ${CMAKE_COMMAND} --install ${zlib_BINARY_DIR} | 127 | NAME zlib_install |
| 116 | --prefix ${CMAKE_CURRENT_BINARY_DIR}/test_install | 128 | COMMAND ${CMAKE_COMMAND} --install ${zlib_BINARY_DIR} --prefix |
| 117 | --config $<CONFIG> | 129 | ${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG> |
| 118 | WORKING_DIRECTORY ${zlib_BINARY_DIR}) | 130 | WORKING_DIRECTORY ${zlib_BINARY_DIR}) |
| 119 | 131 | ||
| 120 | set_tests_properties(zlib_install | 132 | set_tests_properties(zlib_install PROPERTIES FIXTURES_SETUP zlib_install) |
| 121 | PROPERTIES | ||
| 122 | FIXTURES_SETUP zlib_install) | ||
| 123 | 133 | ||
| 124 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) | 134 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) |
| 125 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test) | 135 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test) |
| 126 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test) | 136 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test) |
| 127 | 137 | ||
| 128 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in | 138 | configure_file( |
| 129 | ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt | 139 | ${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in |
| 130 | @ONLY) | 140 | ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY) |
| 131 | 141 | ||
| 132 | configure_file( | 142 | configure_file( |
| 133 | ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in | 143 | ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in |
| 134 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt | 144 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY) |
| 135 | @ONLY) | ||
| 136 | 145 | ||
| 137 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in | 146 | configure_file( |
| 147 | ${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in | ||
| 138 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt | 148 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt |
| 139 | @ONLY) | 149 | @ONLY) |
| 140 | 150 | ||
| @@ -147,107 +157,107 @@ endif(GENERATOR) | |||
| 147 | # | 157 | # |
| 148 | # findpackage_test | 158 | # findpackage_test |
| 149 | # | 159 | # |
| 150 | add_test(NAME zlib_find_package_configure | 160 | add_test( |
| 151 | COMMAND ${CMAKE_COMMAND} | 161 | NAME zlib_find_package_configure |
| 152 | ${PLATFORM} | 162 | COMMAND |
| 163 | ${CMAKE_COMMAND} ${PLATFORM} | ||
| 153 | -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build | 164 | -B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build |
| 154 | -DCMAKE_BUILD_TYPE=$<CONFIG> | 165 | -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} |
| 155 | -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | ||
| 156 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | 166 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} |
| 157 | -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install | 167 | -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh |
| 158 | --fresh | 168 | -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) |
| 159 | -G "${CMAKE_GENERATOR}" | 169 | |
| 160 | -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) | 170 | add_test( |
| 161 | 171 | NAME zlib_find_package_build | |
| 162 | add_test(NAME zlib_find_package_build | 172 | COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG> |
| 163 | COMMAND ${CMAKE_COMMAND} --build . | ||
| 164 | --config $<CONFIG> | ||
| 165 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build) | 173 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build) |
| 166 | 174 | ||
| 167 | add_test(NAME zlib_find_package_test | 175 | add_test( |
| 176 | NAME zlib_find_package_test | ||
| 168 | COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> | 177 | COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> |
| 169 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build) | 178 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build) |
| 170 | 179 | ||
| 171 | set_tests_properties(zlib_find_package_configure PROPERTIES | 180 | set_tests_properties( |
| 172 | FIXTURES_REQUIRED zlib_install | 181 | zlib_find_package_configure PROPERTIES FIXTURES_REQUIRED zlib_install |
| 173 | FIXTURES_SETUP fp_config) | 182 | FIXTURES_SETUP fp_config) |
| 174 | 183 | ||
| 175 | set_tests_properties(zlib_find_package_build PROPERTIES | 184 | set_tests_properties( |
| 176 | FIXTURES_REQUIRED fp_config | 185 | zlib_find_package_build PROPERTIES FIXTURES_REQUIRED fp_config |
| 177 | FIXTURES_SETUP fp_build) | 186 | FIXTURES_SETUP fp_build) |
| 178 | 187 | ||
| 179 | set_tests_properties(zlib_find_package_test PROPERTIES | 188 | set_tests_properties( |
| 180 | FIXTURES_REQUIRED fp_build | 189 | zlib_find_package_test PROPERTIES FIXTURES_REQUIRED fp_build ENVIRONMENT |
| 181 | ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1) | 190 | CTEST_OUTPUT_ON_FAILURE=1) |
| 182 | 191 | ||
| 183 | # | 192 | # |
| 184 | # add_subdirectory_test | 193 | # add_subdirectory_test |
| 185 | # | 194 | # |
| 186 | add_test(NAME zlib_add_subdirectory_configure | 195 | add_test( |
| 187 | COMMAND ${CMAKE_COMMAND} | 196 | NAME zlib_add_subdirectory_configure |
| 188 | ${PLATFORM} | 197 | COMMAND |
| 189 | -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build | 198 | ${CMAKE_COMMAND} ${PLATFORM} |
| 190 | -DCMAKE_BUILD_TYPE=$<CONFIG> | 199 | -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build |
| 191 | -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | 200 | -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} |
| 192 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | 201 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} |
| 193 | -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install | 202 | -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh |
| 194 | --fresh | 203 | -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) |
| 195 | -G "${CMAKE_GENERATOR}" | 204 | |
| 196 | -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) | 205 | add_test( |
| 197 | 206 | NAME zlib_add_subdirectory_build | |
| 198 | add_test(NAME zlib_add_subdirectory_build | 207 | COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG> |
| 199 | COMMAND ${CMAKE_COMMAND} --build . | ||
| 200 | --config $<CONFIG> | ||
| 201 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build) | 208 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build) |
| 202 | 209 | ||
| 203 | add_test(NAME zlib_add_subdirectory_test | 210 | add_test( |
| 211 | NAME zlib_add_subdirectory_test | ||
| 204 | COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> | 212 | COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> |
| 205 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build) | 213 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build) |
| 206 | 214 | ||
| 207 | set_tests_properties(zlib_add_subdirectory_configure PROPERTIES | 215 | set_tests_properties( |
| 208 | FIXTURES_REQUIRED zlib_install | 216 | zlib_add_subdirectory_configure PROPERTIES FIXTURES_REQUIRED zlib_install |
| 209 | FIXTURES_SETUP as_config) | 217 | FIXTURES_SETUP as_config) |
| 210 | 218 | ||
| 211 | set_tests_properties(zlib_add_subdirectory_build PROPERTIES | 219 | set_tests_properties( |
| 212 | FIXTURES_REQUIRED as_config | 220 | zlib_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED as_config |
| 213 | FIXTURES_SETUP as_build) | 221 | FIXTURES_SETUP as_build) |
| 214 | 222 | ||
| 215 | set_tests_properties(zlib_add_subdirectory_test PROPERTIES | 223 | set_tests_properties( |
| 216 | FIXTURES_REQUIRED as_build | 224 | zlib_add_subdirectory_test PROPERTIES FIXTURES_REQUIRED as_build |
| 217 | ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1) | 225 | ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1) |
| 218 | 226 | ||
| 219 | # | 227 | # |
| 220 | # add_subdirectory_exclude_test | 228 | # add_subdirectory_exclude_test |
| 221 | # | 229 | # |
| 222 | add_test(NAME zlib_add_subdirectory_exclude_configure | 230 | add_test( |
| 223 | COMMAND ${CMAKE_COMMAND} | 231 | NAME zlib_add_subdirectory_exclude_configure |
| 224 | ${PLATFORM} | 232 | COMMAND |
| 225 | -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build | 233 | ${CMAKE_COMMAND} ${PLATFORM} |
| 226 | -DCMAKE_BUILD_TYPE=$<CONFIG> | 234 | -B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build |
| 227 | -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | 235 | -DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} |
| 228 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | 236 | -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} |
| 229 | -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install | 237 | -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/test_install --fresh |
| 230 | --fresh | 238 | -G "${CMAKE_GENERATOR}" -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) |
| 231 | -G "${CMAKE_GENERATOR}" | 239 | |
| 232 | -S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) | 240 | add_test( |
| 233 | 241 | NAME zlib_add_subdirectory_exclude_build | |
| 234 | add_test(NAME zlib_add_subdirectory_exclude_build | 242 | COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG> |
| 235 | COMMAND ${CMAKE_COMMAND} --build . | 243 | WORKING_DIRECTORY |
| 236 | --config $<CONFIG> | 244 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build) |
| 237 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build) | 245 | |
| 238 | 246 | add_test( | |
| 239 | add_test(NAME zlib_add_subdirectory_exclude_test | 247 | NAME zlib_add_subdirectory_exclude_test |
| 240 | COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> | 248 | COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIG> |
| 241 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build) | 249 | WORKING_DIRECTORY |
| 250 | ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build) | ||
| 242 | 251 | ||
| 243 | set_tests_properties(zlib_add_subdirectory_exclude_configure PROPERTIES | 252 | set_tests_properties( |
| 244 | FIXTURES_REQUIRED zlib_install | 253 | zlib_add_subdirectory_exclude_configure |
| 245 | FIXTURES_SETUP asx_config) | 254 | PROPERTIES FIXTURES_REQUIRED zlib_install FIXTURES_SETUP asx_config) |
| 246 | 255 | ||
| 247 | set_tests_properties(zlib_add_subdirectory_exclude_build PROPERTIES | 256 | set_tests_properties( |
| 248 | FIXTURES_REQUIRED as_config | 257 | zlib_add_subdirectory_exclude_build PROPERTIES FIXTURES_REQUIRED as_config |
| 249 | FIXTURES_SETUP asx_build) | 258 | FIXTURES_SETUP asx_build) |
| 250 | 259 | ||
| 251 | set_tests_properties(zlib_add_subdirectory_exclude_test PROPERTIES | 260 | set_tests_properties( |
| 252 | FIXTURES_REQUIRED asx_build | 261 | zlib_add_subdirectory_exclude_test |
| 253 | ENVIRONMENT CTEST_OUTPUT_ON_FAILURE=1) | 262 | PROPERTIES FIXTURES_REQUIRED asx_build ENVIRONMENT |
| 263 | CTEST_OUTPUT_ON_FAILURE=1) | ||
diff --git a/test/add_subdirectory_exclude_test.cmake.in b/test/add_subdirectory_exclude_test.cmake.in index c751a7a..c1e8cf4 100644 --- a/test/add_subdirectory_exclude_test.cmake.in +++ b/test/add_subdirectory_exclude_test.cmake.in | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.10) | 1 | cmake_minimum_required(VERSION 3.10) |
| 2 | 2 | ||
| 3 | project(zlib_find_package_test | 3 | project( |
| 4 | zlib_find_package_test | ||
| 4 | LANGUAGES C | 5 | LANGUAGES C |
| 5 | VERSION @zlib_VERSION@) | 6 | VERSION @zlib_VERSION@) |
| 6 | 7 | ||
| @@ -9,7 +10,8 @@ option(ZLIB_BUILD_TESTING "" OFF) | |||
| 9 | option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@) | 10 | option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@) |
| 10 | option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@) | 11 | option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@) |
| 11 | 12 | ||
| 12 | add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib EXCLUDE_FROM_ALL) | 13 | add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib |
| 14 | EXCLUDE_FROM_ALL) | ||
| 13 | 15 | ||
| 14 | if(ZLIB_BUILD_SHARED) | 16 | if(ZLIB_BUILD_SHARED) |
| 15 | add_executable(test_example @zlib_SOURCE_DIR@/test/example.c) | 17 | add_executable(test_example @zlib_SOURCE_DIR@/test/example.c) |
| @@ -23,6 +25,5 @@ endif(ZLIB_BUILD_SHARED) | |||
| 23 | if(ZLIB_BUILD_STATIC) | 25 | if(ZLIB_BUILD_STATIC) |
| 24 | add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c) | 26 | add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c) |
| 25 | target_link_libraries(test_example_static ZLIB::ZLIBSTATIC) | 27 | target_link_libraries(test_example_static ZLIB::ZLIBSTATIC) |
| 26 | add_test(NAME zlib_test_example_static | 28 | add_test(NAME zlib_test_example_static COMMAND test_example_static) |
| 27 | COMMAND test_example_static) | ||
| 28 | endif(ZLIB_BUILD_STATIC) | 29 | endif(ZLIB_BUILD_STATIC) |
diff --git a/test/add_subdirectory_test.cmake.in b/test/add_subdirectory_test.cmake.in index d5e3a05..c7d20f8 100644 --- a/test/add_subdirectory_test.cmake.in +++ b/test/add_subdirectory_test.cmake.in | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.10) | 1 | cmake_minimum_required(VERSION 3.10) |
| 2 | 2 | ||
| 3 | project(zlib_find_package_test | 3 | project( |
| 4 | zlib_find_package_test | ||
| 4 | LANGUAGES C | 5 | LANGUAGES C |
| 5 | VERSION @zlib_VERSION@) | 6 | VERSION @zlib_VERSION@) |
| 6 | 7 | ||
| @@ -23,6 +24,5 @@ endif(ZLIB_BUILD_SHARED) | |||
| 23 | if(ZLIB_BUILD_STATIC) | 24 | if(ZLIB_BUILD_STATIC) |
| 24 | add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c) | 25 | add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c) |
| 25 | target_link_libraries(test_example_static ZLIB::ZLIBSTATIC) | 26 | target_link_libraries(test_example_static ZLIB::ZLIBSTATIC) |
| 26 | add_test(NAME zlib_test_example_static | 27 | add_test(NAME zlib_test_example_static COMMAND test_example_static) |
| 27 | COMMAND test_example_static) | ||
| 28 | endif(@ZLIB_BUILD_STATIC) | 28 | endif(@ZLIB_BUILD_STATIC) |
diff --git a/test/find_package_test.cmake.in b/test/find_package_test.cmake.in index 728a1a4..afacde5 100644 --- a/test/find_package_test.cmake.in +++ b/test/find_package_test.cmake.in | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.10) | 1 | cmake_minimum_required(VERSION 3.10) |
| 2 | 2 | ||
| 3 | project(zlib_find_package_test | 3 | project( |
| 4 | zlib_find_package_test | ||
| 4 | LANGUAGES C | 5 | LANGUAGES C |
| 5 | VERSION @zlib_VERSION@) | 6 | VERSION @zlib_VERSION@) |
| 6 | 7 | ||
| @@ -21,6 +22,5 @@ endif(ZLIB_BUILD_SHARED) | |||
| 21 | if(ZLIB_BUILD_STATIC) | 22 | if(ZLIB_BUILD_STATIC) |
| 22 | add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c) | 23 | add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c) |
| 23 | target_link_libraries(test_example_static ZLIB::ZLIBSTATIC) | 24 | target_link_libraries(test_example_static ZLIB::ZLIBSTATIC) |
| 24 | add_test(NAME zlib_test_example_static | 25 | add_test(NAME zlib_test_example_static COMMAND test_example_static) |
| 25 | COMMAND test_example_static) | ||
| 26 | endif(ZLIB_BUILD_STATIC) | 26 | endif(ZLIB_BUILD_STATIC) |
diff --git a/zlibConfig.cmake.in b/zlibConfig.cmake.in index d7a849b..713cac4 100644 --- a/zlibConfig.cmake.in +++ b/zlibConfig.cmake.in | |||
| @@ -12,7 +12,7 @@ endif(@ZLIB_BUILD_STATIC@) | |||
| 12 | 12 | ||
| 13 | if(ZLIB_FIND_COMPONENTS) | 13 | if(ZLIB_FIND_COMPONENTS) |
| 14 | foreach(_comp ${ZLIB_FIND_COMPONENTS}) | 14 | foreach(_comp ${ZLIB_FIND_COMPONENTS}) |
| 15 | if (NOT _comp IN_LIST _ZLIB_supported_components) | 15 | if(NOT _comp IN_LIST _ZLIB_supported_components) |
| 16 | set(ZLIB_FOUND False) | 16 | set(ZLIB_FOUND False) |
| 17 | set(ZLIB_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") | 17 | set(ZLIB_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}") |
| 18 | endif(NOT _comp IN_LIST _ZLIB_supported_components) | 18 | endif(NOT _comp IN_LIST _ZLIB_supported_components) |
