-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
1333 lines (1226 loc) · 49.8 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
cmake_minimum_required(VERSION 3.5.1)
if(CMAKE_VERSION VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_VERSION})
else()
cmake_policy(VERSION 3.5.1...3.13.2)
endif()
message(STATUS "Using CMake version ${CMAKE_VERSION}")
set(CMAKE_MACOSX_RPATH 1)
# If not specified on the command line, enable C11 as the default
# Configuration items that affect the global compiler environment standards
# should be issued before the "project" command.
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 11) # The C standard whose features are requested to build this target
endif()
if(NOT CMAKE_C_STANDARD_REQUIRED)
set(CMAKE_C_STANDARD_REQUIRED ON) # Boolean describing whether the value of C_STANDARD is a requirement
endif()
if(NOT CMAKE_C_EXTENSIONS)
set(CMAKE_C_EXTENSIONS OFF) # Boolean specifying whether compiler specific extensions are requested
endif()
set(VALID_C_STANDARDS "99" "11")
if(NOT CMAKE_C_STANDARD IN_LIST VALID_C_STANDARDS)
MESSAGE(FATAL_ERROR "CMAKE_C_STANDARD:STRING=${CMAKE_C_STANDARD} not in known standards list\n ${VALID_C_STANDARDS}")
endif()
# Parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.h _zlib_h_contents)
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9]+.[0-9]+.[0-9]+).*\".*"
"\\1" ZLIB_HEADER_VERSION ${_zlib_h_contents})
string(REGEX REPLACE ".*#define[ \t]+ZLIBNG_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
"\\1" ZLIBNG_HEADER_VERSION ${_zlib_h_contents})
message(STATUS "ZLIB_HEADER_VERSION: ${ZLIB_HEADER_VERSION}")
message(STATUS "ZLIBNG_HEADER_VERSION: ${ZLIBNG_HEADER_VERSION}")
project(zlib VERSION ${ZLIB_HEADER_VERSION} LANGUAGES C)
include(CheckTypeSize)
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
include(CheckCSourceRuns)
include(CheckCCompilerFlag)
include(CMakeDependentOption)
include(FeatureSummary)
include(cmake/detect-arch.cmake)
include(cmake/detect-install-dirs.cmake)
include(cmake/detect-coverage.cmake)
include(cmake/detect-intrinsics.cmake)
include(cmake/detect-sanitizer.cmake)
if(CMAKE_TOOLCHAIN_FILE)
message(STATUS "Using CMake toolchain: ${CMAKE_TOOLCHAIN_FILE}")
endif()
# Make sure we use an appropriate BUILD_TYPE by default, "Release" to be exact
# this should select the maximum generic optimisation on the current platform (i.e. -O3 for gcc/clang)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, standard options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (default)")
else()
add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (selected)")
endif()
#
# Options parsing
#
option(WITH_GZFILEOP "Compile with support for gzFile related functions" ON)
option(ZLIB_COMPAT "Compile with zlib compatible API" OFF)
option(ZLIB_ENABLE_TESTS "Build test binaries" ON)
option(ZLIB_DUAL_LINK "Dual link tests against system zlib" OFF)
option(WITH_FUZZERS "Build test/fuzz" OFF)
option(WITH_OPTIM "Build with optimisation" ON)
option(WITH_REDUCED_MEM "Reduced memory usage for special cases (reduces performance)" OFF)
option(WITH_NEW_STRATEGIES "Use new strategies" ON)
option(WITH_NATIVE_INSTRUCTIONS
"Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)" OFF)
option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF)
option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF)
option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF)
option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF)
option(WITH_UNALIGNED "Support unaligned reads on platforms that support it" ON)
# Add multi-choice option
set(WITH_SANITIZER AUTO CACHE STRING "Enable sanitizer support")
set_property(CACHE WITH_SANITIZER PROPERTY STRINGS "Memory" "Address" "Undefined" "Thread")
if(BASEARCH_ARM_FOUND)
option(WITH_ACLE "Build with ACLE" ON)
option(WITH_NEON "Build with NEON intrinsics" ON)
elseif(BASEARCH_PPC_FOUND)
option(WITH_POWER8 "Build with optimisations for POWER8" ON)
elseif(BASEARCH_S360_FOUND)
option(WITH_DFLTCC_DEFLATE "Build with DFLTCC intrinsics for compression on IBM Z" OFF)
option(WITH_DFLTCC_INFLATE "Build with DFLTCC intrinsics for decompression on IBM Z" OFF)
option(WITH_CRC32_VX "Build with vectorized CRC32 on IBM Z" ON)
elseif(BASEARCH_X86_FOUND)
option(WITH_AVX2 "Build with AVX2" ON)
option(WITH_SSE2 "Build with SSE2" ON)
option(WITH_SSSE3 "Build with SSSE3" ON)
option(WITH_SSE4 "Build with SSE4" ON)
option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON)
endif()
option(INSTALL_UTILS "Copy minigzip and minideflate during install" OFF)
mark_as_advanced(FORCE
ZLIB_DUAL_LINK
WITH_REDUCED_MEM
WITH_ACLE WITH_NEON
WITH_DFLTCC_DEFLATE
WITH_DFLTCC_INFLATE
WITH_CRC32_VX
WITH_AVX2 WITH_SSE2
WITH_SSSE3 WITH_SSE4
WITH_PCLMULQDQ
WITH_POWER8
WITH_INFLATE_STRICT
WITH_INFLATE_ALLOW_INVALID_DIST
WITH_UNALIGNED
INSTALL_UTILS
)
if(ZLIB_COMPAT)
add_definitions(-DZLIB_COMPAT)
set(WITH_GZFILEOP ON)
set(SUFFIX "")
else()
set(SUFFIX "-ng")
endif()
if(WITH_GZFILEOP)
add_definitions(-DWITH_GZFILEOP)
endif()
if(CMAKE_C_COMPILER_ID MATCHES "Intel")
if(CMAKE_HOST_UNIX)
set(WARNFLAGS "-w3")
set(WARNFLAGS_MAINTAINER "-w3 -Wcheck -Wremarks")
set(WARNFLAGS_DISABLE "")
else()
set(WARNFLAGS "/W3")
set(WARNFLAGS_MAINTAINER "/W5")
set(WARNFLAGS_DISABLE "")
endif()
if(WITH_NATIVE_INSTRUCTIONS)
message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not supported on this configuration")
set(WITH_NATIVE_INSTRUCTIONS OFF)
endif()
elseif(MSVC)
# Minimum supported MSVC version is 1800 = Visual Studio 12.0/2013
# See also https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
if(MSVC_VERSION VERSION_LESS 1800)
message(SEND_ERROR "Unsupported Visual Studio compiler version (requires 2013 or later).")
endif()
# TODO. ICC can be used through MSVC. I'm not sure if we'd ever see that combination
# (who'd use cmake from an IDE...) but checking for ICC before checking for MSVC should
# avoid mistakes.
# /Oi ?
set(WARNFLAGS "/W3")
set(WARNFLAGS_MAINTAINER "/W4")
set(WARNFLAGS_DISABLE "")
if(BASEARCH_ARM_FOUND)
add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE)
if(NOT "${ARCH}" MATCHES "aarch64")
set(NEONFLAG "/arch:VFPv4")
endif()
endif()
if(WITH_NATIVE_INSTRUCTIONS)
message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not supported on this configuration")
set(WITH_NATIVE_INSTRUCTIONS OFF)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
# Enable warnings in GCC and Clang
set(WARNFLAGS "-Wall")
set(WARNFLAGS_MAINTAINER "-Wextra -Wpedantic")
set(WARNFLAGS_DISABLE "-Wno-implicit-fallthrough")
if(WITH_NATIVE_INSTRUCTIONS)
if(BASEARCH_PPC_FOUND)
set(NATIVEFLAG "-mcpu=native")
else()
set(NATIVEFLAG "-march=native")
endif()
else()
if(BASEARCH_ARM_FOUND)
if("${ARCH}" MATCHES "arm" AND NOT CMAKE_C_FLAGS MATCHES "-mfloat-abi")
# Auto-detect support for ARM floating point ABI
check_c_compiler_flag(-mfloat-abi=softfp HAVE_FLOATABI_SOFTFP)
if(HAVE_FLOATABI_SOFTFP)
set(FLOATABI "-mfloat-abi=softfp")
else()
check_c_compiler_flag(-mfloat-abi=hard HAVE_FLOATABI_HARD)
if(HAVE_FLOATABI_HARD)
set(FLOATABI "-mfloat-abi=hard")
endif()
endif()
if(FLOATABI)
message(STATUS "ARM floating point arch: ${FLOATABI}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLOATABI}")
else()
message(STATUS "ARM floating point arch not auto-detected")
endif()
endif()
endif()
# Check whether -fno-lto is available
set(CMAKE_REQUIRED_FLAGS "-fno-lto")
check_c_source_compiles(
"int main() { return 0; }"
FNO_LTO_AVAILABLE FAIL_REGEX "not supported")
set(CMAKE_REQUIRED_FLAGS)
if(FNO_LTO_AVAILABLE)
set(NOLTOFLAG "-fno-lto")
endif()
endif()
else()
if(WITH_NATIVE_INSTRUCTIONS)
message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not implemented yet on this configuration")
set(WITH_NATIVE_INSTRUCTIONS OFF)
endif()
endif()
# Replace optimization level 3 added by default with level 2
if(NOT MSVC AND NOT CMAKE_C_FLAGS MATCHES "([\\/\\-]O)3")
string(REGEX REPLACE "([\\/\\-]O)3" "\\12"
CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif()
# Set architecture alignment requirements
if(WITH_UNALIGNED)
if(BASEARCH_ARM_FOUND OR (BASEARCH_PPC_FOUND AND "${ARCH}" MATCHES "powerpc64le") OR BASEARCH_X86_FOUND)
if(NOT DEFINED UNALIGNED_OK)
set(UNALIGNED_OK TRUE)
endif()
endif()
if(UNALIGNED_OK)
add_definitions(-DUNALIGNED_OK)
message(STATUS "Architecture supports unaligned reads")
endif()
if(BASEARCH_ARM_FOUND)
if(NOT DEFINED UNALIGNED64_OK)
if("${ARCH}" MATCHES "(arm(v[8-9])?|aarch64)")
set(UNALIGNED64_OK TRUE)
endif()
endif()
endif()
if(BASEARCH_PPC_FOUND)
if(NOT DEFINED UNALIGNED64_OK)
if("${ARCH}" MATCHES "powerpc64le")
set(UNALIGNED64_OK TRUE)
endif()
endif()
endif()
if(BASEARCH_X86_FOUND)
if(NOT DEFINED UNALIGNED64_OK)
set(UNALIGNED64_OK TRUE)
endif()
endif()
if(UNALIGNED64_OK)
add_definitions(-DUNALIGNED64_OK)
message(STATUS "Architecture supports unaligned reads of > 4 bytes")
endif()
else()
message(STATUS "Unaligned reads manually disabled")
endif()
# Apply warning compiler flags
if(WITH_MAINTAINER_WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNFLAGS} ${WARNFLAGS_MAINTAINER} ${WARNFLAGS_DISABLE}")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNFLAGS} ${WARNFLAGS_DISABLE}")
endif()
# Set code coverage compiler flags
if(WITH_CODE_COVERAGE)
add_code_coverage()
endif()
# Set native instruction set compiler flag
if(WITH_NATIVE_INSTRUCTIONS AND DEFINED NATIVEFLAG)
# Apply flag to all source files and compilation checks
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NATIVEFLAG}")
endif()
#
# Check for standard/system includes
#
check_include_file(sys/sdt.h HAVE_SYS_SDT_H)
if(HAVE_SYS_SDT_H)
add_definitions(-DHAVE_SYS_SDT_H)
endif()
check_include_file(unistd.h HAVE_UNISTD_H)
#
# Check to see if we have large file support
#
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64)
check_type_size(off64_t OFF64_T)
if(HAVE_OFF64_T)
add_definitions(-D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64)
else()
check_type_size(_off64_t _OFF64_T)
if(HAVE__OFF64_T)
add_definitions(-D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64)
else()
check_type_size(__off64_t __OFF64_T)
endif()
endif()
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
#
# Check for fseeko and other optional functions
#
check_function_exists(fseeko HAVE_FSEEKO)
if(NOT HAVE_FSEEKO)
add_definitions(-DNO_FSEEKO)
endif()
check_function_exists(strerror HAVE_STRERROR)
if(NOT HAVE_STRERROR)
add_definitions(-DNO_STRERROR)
endif()
set(CMAKE_REQUIRED_DEFINITIONS -D _POSIX_C_SOURCE=200112L)
check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN)
if(HAVE_POSIX_MEMALIGN)
add_definitions(-DHAVE_POSIX_MEMALIGN)
endif()
set(CMAKE_REQUIRED_DEFINITIONS)
if(WITH_SANITIZER STREQUAL "Address")
add_address_sanitizer()
elseif(WITH_SANITIZER STREQUAL "Memory")
add_memory_sanitizer()
elseif(WITH_SANITIZER STREQUAL "Thread")
add_thread_sanitizer()
elseif(WITH_SANITIZER STREQUAL "Undefined")
add_undefined_sanitizer()
endif()
#
# Check whether compiler supports -fno-semantic-interposition parameter
#
check_c_compiler_flag(-fno-semantic-interposition HAVE_NO_INTERPOSITION)
#
# Check if we can hide zlib internal symbols that are linked between separate source files using hidden
#
check_c_source_compiles(
"#define Z_INTERNAL __attribute__((visibility (\"hidden\")))
int Z_INTERNAL foo;
int main() {
return 0;
}"
HAVE_ATTRIBUTE_VISIBILITY_HIDDEN FAIL_REGEX "not supported")
if(HAVE_ATTRIBUTE_VISIBILITY_HIDDEN)
add_definitions(-DHAVE_VISIBILITY_HIDDEN)
endif()
#
# Check if we can hide zlib internal symbols that are linked between separate source files using internal
#
check_c_source_compiles(
"#define Z_INTERNAL __attribute__((visibility (\"internal\")))
int Z_INTERNAL foo;
int main() {
return 0;
}"
HAVE_ATTRIBUTE_VISIBILITY_INTERNAL FAIL_REGEX "not supported")
if(HAVE_ATTRIBUTE_VISIBILITY_INTERNAL)
add_definitions(-DHAVE_VISIBILITY_INTERNAL)
endif()
#
# check for __builtin_ctz() support in the compiler
#
check_c_source_compiles(
"int main(void) {
unsigned int zero = 0;
long test = __builtin_ctz(zero);
(void)test;
return 0;
}"
HAVE_BUILTIN_CTZ
)
if(HAVE_BUILTIN_CTZ)
add_definitions(-DHAVE_BUILTIN_CTZ)
endif()
#
# check for __builtin_ctzll() support in the compiler
#
check_c_source_compiles(
"int main(void) {
unsigned int zero = 0;
long test = __builtin_ctzll(zero);
(void)test;
return 0;
}"
HAVE_BUILTIN_CTZLL
)
if(HAVE_BUILTIN_CTZLL)
add_definitions(-DHAVE_BUILTIN_CTZLL)
endif()
#
# check for ptrdiff_t support
#
check_c_source_compiles(
"#include <stddef.h>
int main() {
ptrdiff_t *a;
(void)a;
return 0;
}"
HAVE_PTRDIFF_T
)
if(NOT HAVE_PTRDIFF_T)
set(NEED_PTRDIFF_T 1)
check_type_size("void *" SIZEOF_DATA_PTR)
message(STATUS "sizeof(void *) is ${SIZEOF_DATA_PTR} bytes")
if(${SIZEOF_DATA_PTR} MATCHES "4")
set(PTRDIFF_TYPE "uint32_t")
elseif(${SIZEOF_DATA_PTR} MATCHES "8")
set(PTRDIFF_TYPE "uint64_t")
else()
message(FATAL_ERROR "sizeof(void *) is neither 32 nor 64 bit")
endif()
endif()
# Macro to check if source compiles
# (and, when compiling very natively, also runs).
macro(check_c_source_compile_or_run source flag)
if(CMAKE_CROSSCOMPILING OR NOT WITH_NATIVE_INSTRUCTIONS)
check_c_source_compiles("${source}" ${flag})
else()
check_c_source_runs("${source}" ${flag})
endif()
endmacro()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DZLIB_DEBUG")
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
endif()
if(BASEARCH_X86_FOUND)
# FORCE_SSE2 option will only be shown if HAVE_SSE2_INTRIN is true
if("${ARCH}" MATCHES "i[3-6]86")
cmake_dependent_option(FORCE_SSE2 "Always assume CPU is SSE2 capable" OFF "HAVE_SSE2_INTRIN" OFF)
endif()
endif()
#
# Enable deflate_quick at level 1
#
if(NOT WITH_NEW_STRATEGIES)
add_definitions(-DNO_QUICK_STRATEGY)
endif()
#
# Enable deflate_medium at level 4-6
#
if(NOT WITH_NEW_STRATEGIES)
add_definitions(-DNO_MEDIUM_STRATEGY)
endif()
#
# Enable inflate compilation options
#
if(WITH_INFLATE_STRICT)
add_definitions(-DINFLATE_STRICT)
message(STATUS "Inflate strict distance checking enabled")
endif()
if(WITH_INFLATE_ALLOW_INVALID_DIST)
add_definitions(-DINFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR)
message(STATUS "Inflate zero data for invalid distances enabled")
endif()
#
# Enable reduced memory configuration
#
if(WITH_REDUCED_MEM)
add_definitions(-DHASH_SIZE=32768u -DGZBUFSIZE=8192)
message(STATUS "Configured for reduced memory environment")
endif()
set(ZLIB_ARCH_SRCS)
set(ZLIB_ARCH_HDRS)
set(ARCHDIR "arch/generic")
if(BASEARCH_ARM_FOUND)
set(ARCHDIR "arch/arm")
elseif(BASEARCH_PPC_FOUND)
set(ARCHDIR "arch/power")
elseif(BASEARCH_S360_FOUND)
set(ARCHDIR "arch/s390")
elseif(BASEARCH_X86_FOUND)
set(ARCHDIR "arch/x86")
if(NOT ${ARCH} MATCHES "x86_64")
add_feature_info(SSE2 1 "Support the SSE2 instruction set, using \"${SSE2FLAG}\"")
endif()
else()
message(STATUS "No optimized architecture: using ${ARCHDIR}")
endif()
if(WITH_OPTIM)
if(BASEARCH_ARM_FOUND)
add_definitions(-DARM_FEATURES)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(NOT "${ARCH}" MATCHES "aarch64")
check_c_source_compiles(
"#include <sys/auxv.h>
int main() {
return (getauxval(AT_HWCAP2) & HWCAP2_CRC32);
}"
ARM_AUXV_HAS_CRC32
)
if(ARM_AUXV_HAS_CRC32)
add_definitions(-DARM_AUXV_HAS_CRC32)
else()
check_c_source_compiles(
"#include <sys/auxv.h>
#include <asm/hwcap.h>
int main() {
return (getauxval(AT_HWCAP2) & HWCAP2_CRC32);
}"
ARM_HWCAP_HAS_CRC32
)
if (ARM_HWCAP_HAS_CRC32)
add_definitions(-DARM_AUXV_HAS_CRC32 -DARM_ASM_HWCAP)
else()
message(STATUS "HWCAP2_CRC32 not present in sys/auxv.h; cannot detect support at runtime.")
endif()
endif()
else()
check_c_source_compiles(
"#include <sys/auxv.h>
int main() {
return (getauxval(AT_HWCAP) & HWCAP_CRC32);
}"
ARM_AUXV_HAS_CRC32
)
if(ARM_AUXV_HAS_CRC32)
add_definitions(-DARM_AUXV_HAS_CRC32)
else()
message(STATUS "HWCAP_CRC32 not present in sys/auxv.h; cannot detect support at runtime.")
endif()
endif()
if(NOT "${ARCH}" MATCHES "aarch64")
check_c_source_compiles(
"#include <sys/auxv.h>
int main() {
return (getauxval(AT_HWCAP) & HWCAP_ARM_NEON);
}"
ARM_AUXV_HAS_NEON
)
if(ARM_AUXV_HAS_NEON)
add_definitions(-DARM_AUXV_HAS_NEON)
else()
check_c_source_compiles(
"#include <sys/auxv.h>
int main() {
return (getauxval(AT_HWCAP) & HWCAP_NEON);
}"
ARM_AUXV_HAS_NEON
)
if (ARM_AUXV_HAS_NEON)
add_definitions(-DARM_AUXV_HAS_NEON)
else()
message(STATUS "Neither HWCAP_ARM_NEON or HWCAP_NEON present in sys/auxv.h; cannot detect support at runtime.")
endif()
endif()
endif()
endif()
list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/arm.h)
list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/armfeature.c)
if(WITH_ACLE AND NOT MSVC)
check_acle_intrinsics()
if(HAVE_ACLE_INTRIN)
add_definitions(-DARM_ACLE_CRC_HASH)
set(ACLE_SRCS ${ARCHDIR}/crc32_acle.c ${ARCHDIR}/insert_string_acle.c)
set_property(SOURCE ${ACLE_SRCS} PROPERTY COMPILE_FLAGS "${ACLEFLAG} ${NOLTOFLAG}")
list(APPEND ZLIB_ARCH_SRCS ${ACLE_SRCS})
add_feature_info(ACLE_CRC 1 "Support ACLE optimized CRC hash generation, using \"${ACLEFLAG}\"")
else()
set(WITH_ACLE OFF)
endif()
else()
set(WITH_ACLE OFF)
endif()
if(WITH_NEON)
check_neon_intrinsics()
if(MFPU_NEON_AVAILABLE)
add_definitions(-DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH)
set(NEON_SRCS ${ARCHDIR}/adler32_neon.c ${ARCHDIR}/chunkset_neon.c ${ARCHDIR}/slide_hash_neon.c)
list(APPEND ZLIB_ARCH_SRCS ${NEON_SRCS})
set_property(SOURCE ${NEON_SRCS} PROPERTY COMPILE_FLAGS "${NEONFLAG} ${NOLTOFLAG}")
if(MSVC)
add_definitions(-D__ARM_NEON__)
endif()
add_feature_info(NEON_ADLER32 1 "Support NEON instructions in adler32, using \"${NEONFLAG}\"")
add_feature_info(NEON_SLIDEHASH 1 "Support NEON instructions in slide_hash, using \"${NEONFLAG}\"")
else()
set(WITH_NEON OFF)
endif()
endif()
elseif(BASEARCH_PPC_FOUND)
if(WITH_POWER8)
check_power8_intrinsics()
if(HAVE_POWER8_INTRIN)
add_definitions(-DPOWER8)
add_definitions(-DPOWER_FEATURES)
add_definitions(-DPOWER8_VSX_ADLER32)
add_definitions(-DPOWER8_VSX_CHUNKSET)
add_definitions(-DPOWER8_VSX_SLIDEHASH)
list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/power.h)
list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/power.c)
set(POWER8_SRCS ${ARCHDIR}/adler32_power8.c ${ARCHDIR}/chunkset_power8.c ${ARCHDIR}/slide_hash_power8.c)
list(APPEND ZLIB_ARCH_SRCS ${POWER8_SRCS})
set_property(SOURCE ${POWER8_SRCS} PROPERTY COMPILE_FLAGS "${POWER8FLAG} ${NOLTOFLAG}")
else()
set(WITH_POWER8 OFF)
endif()
endif()
elseif(BASEARCH_S360_FOUND)
if(WITH_CRC32_VX)
add_definitions(-DS390_FEATURES)
list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/s390.c)
endif()
if(WITH_DFLTCC_DEFLATE OR WITH_DFLTCC_INFLATE)
list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_common.c)
endif()
if(WITH_DFLTCC_DEFLATE)
add_definitions(-DS390_DFLTCC_DEFLATE)
list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_deflate.c)
endif()
if(WITH_DFLTCC_INFLATE)
add_definitions(-DS390_DFLTCC_INFLATE)
list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_inflate.c)
endif()
if(WITH_CRC32_VX)
check_vgfma_intrinsics()
if(HAVE_VGFMA_INTRIN)
add_definitions(-DS390_CRC32_VX)
set(CRC32_VX_SRCS ${ARCHDIR}/crc32-vx.c)
list(APPEND ZLIB_ARCH_SRCS ${CRC32_VX_SRCS})
set_property(SOURCE ${CRC32_VX_SRCS} PROPERTY COMPILE_FLAGS "${VGFMAFLAG} ${NOLTOFLAG}")
else()
set(WITH_CRC32_VX OFF)
endif()
endif()
elseif(BASEARCH_X86_FOUND)
add_definitions(-DX86_FEATURES)
list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/x86.h)
list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/x86.c)
if(MSVC)
list(APPEND ZLIB_ARCH_HDRS fallback_builtins.h)
endif()
if(WITH_AVX2)
check_avx2_intrinsics()
if(HAVE_AVX2_INTRIN)
add_definitions(-DX86_AVX2 -DX86_AVX2_ADLER32 -DX86_AVX_CHUNKSET)
set(AVX2_SRCS ${ARCHDIR}/slide_hash_avx.c)
add_feature_info(AVX2_SLIDEHASH 1 "Support AVX2 optimized slide_hash, using \"${AVX2FLAG}\"")
list(APPEND AVX2_SRCS ${ARCHDIR}/chunkset_avx.c)
add_feature_info(AVX_CHUNKSET 1 "Support AVX optimized chunkset, using \"${AVX2FLAG}\"")
list(APPEND AVX2_SRCS ${ARCHDIR}/compare258_avx.c)
add_feature_info(AVX2_COMPARE258 1 "Support AVX2 optimized compare258, using \"${AVX2FLAG}\"")
list(APPEND AVX2_SRCS ${ARCHDIR}/adler32_avx.c)
add_feature_info(AVX2_ADLER32 1 "Support AVX2-accelerated adler32, using \"${AVX2FLAG}\"")
list(APPEND ZLIB_ARCH_SRCS ${AVX2_SRCS})
set_property(SOURCE ${AVX2_SRCS} PROPERTY COMPILE_FLAGS "${AVX2FLAG} ${NOLTOFLAG}")
else()
set(WITH_AVX2 OFF)
endif()
endif()
if(WITH_SSE4)
check_sse4_intrinsics()
if(HAVE_SSE42CRC_INLINE_ASM OR HAVE_SSE42CRC_INTRIN)
add_definitions(-DX86_SSE42_CRC_HASH)
set(SSE42_SRCS ${ARCHDIR}/insert_string_sse.c)
add_feature_info(SSE42_CRC 1 "Support SSE4.2 optimized CRC hash generation, using \"${SSE4FLAG}\"")
list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS})
set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE4FLAG} ${NOLTOFLAG}")
if(HAVE_SSE42CRC_INTRIN)
add_definitions(-DX86_SSE42_CRC_INTRIN)
endif()
endif()
if(HAVE_SSE42CMPSTR_INTRIN)
add_definitions(-DX86_SSE42_CMP_STR)
set(SSE42_SRCS ${ARCHDIR}/compare258_sse.c)
add_feature_info(SSE42_COMPARE258 1 "Support SSE4.2 optimized compare258, using \"${SSE4FLAG}\"")
list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS})
set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE4FLAG} ${NOLTOFLAG}")
endif()
if(NOT HAVE_SSE42CRC_INLINE_ASM AND NOT HAVE_SSE42CRC_INTRIN AND NOT HAVE_SSE42CMPSTR_INTRIN)
set(WITH_SSE4 OFF)
endif()
endif()
if(WITH_SSE2)
check_sse2_intrinsics()
if(HAVE_SSE2_INTRIN)
add_definitions(-DX86_SSE2 -DX86_SSE2_CHUNKSET -DX86_SSE2_SLIDEHASH)
set(SSE2_SRCS ${ARCHDIR}/chunkset_sse.c ${ARCHDIR}/slide_hash_sse.c)
list(APPEND ZLIB_ARCH_SRCS ${SSE2_SRCS})
if(NOT ${ARCH} MATCHES "x86_64")
set_property(SOURCE ${SSE2_SRCS} PROPERTY COMPILE_FLAGS "${SSE2FLAG} ${NOLTOFLAG}")
add_feature_info(FORCE_SSE2 FORCE_SSE2 "Assume CPU is SSE2 capable")
if(FORCE_SSE2)
add_definitions(-DX86_NOCHECK_SSE2)
endif()
endif()
else()
set(WITH_SSE2 OFF)
endif()
endif()
if(WITH_SSSE3)
check_ssse3_intrinsics()
if(HAVE_SSSE3_INTRIN)
add_definitions(-DX86_SSSE3 -DX86_SSSE3_ADLER32)
set(SSSE3_SRCS ${ARCHDIR}/adler32_ssse3.c)
add_feature_info(SSSE3_ADLER32 1 "Support SSSE3-accelerated adler32, using \"${SSSE3FLAG}\"")
list(APPEND ZLIB_ARCH_SRCS ${SSSE3_SRCS})
set_property(SOURCE ${SSSE3_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${NOLTOFLAG}")
else()
set(WITH_SSSE3 OFF)
endif()
endif()
if(WITH_PCLMULQDQ AND WITH_SSSE3 AND WITH_SSE4)
check_pclmulqdq_intrinsics()
if(HAVE_PCLMULQDQ_INTRIN AND HAVE_SSSE3_INTRIN)
add_definitions(-DX86_PCLMULQDQ_CRC)
set(PCLMULQDQ_SRCS ${ARCHDIR}/crc_folding.c)
add_feature_info(PCLMUL_CRC 1 "Support CRC hash generation using PCLMULQDQ, using \"${SSSE3FLAG} ${SSE4FLAG} ${PCLMULFLAG}\"")
list(APPEND ZLIB_ARCH_SRCS ${PCLMULQDQ_SRCS})
set_property(SOURCE ${PCLMULQDQ_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${SSE4FLAG} ${PCLMULFLAG} ${NOLTOFLAG}")
else()
set(WITH_PCLMULQDQ OFF)
endif()
else()
set(WITH_PCLMULQDQ OFF)
endif()
endif()
endif()
message(STATUS "Architecture-specific source files: ${ZLIB_ARCH_SRCS}")
#============================================================================
# zconf.h
#============================================================================
macro(generate_cmakein input output)
file(REMOVE ${output})
file(STRINGS ${input} _lines)
foreach(_line IN LISTS _lines)
string(REGEX REPLACE "#ifdef HAVE_UNISTD_H.*" "@ZCONF_UNISTD_LINE@" _line "${_line}")
string(REGEX REPLACE "#ifdef NEED_PTRDIFF_T.*" "@ZCONF_PTRDIFF_LINE@" _line "${_line}")
if(NEED_PTRDIFF_T)
string(REGEX REPLACE "typedef PTRDIFF_TYPE" "typedef @PTRDIFF_TYPE@" _line "${_line}")
endif()
file(APPEND ${output} "${_line}\n")
endforeach()
endmacro(generate_cmakein)
generate_cmakein( ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.in ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h.cmakein )
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
# If we're doing an out of source build and the user has a zconf.h
# in their source tree...
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h)
message(STATUS "Renaming")
message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h")
message(STATUS "to 'zconf${SUFFIX}.h.included' because this file is included with zlib")
message(STATUS "but CMake generates it automatically in the build directory.")
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.included)
endif()
# If we're doing an out of source build and the user has a zconf.h.cmakein
# in their source tree...
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein)
message(STATUS "Renaming")
message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein")
message(STATUS "to 'zconf${SUFFIX}.h.cmakeincluded' because this file is included with zlib")
message(STATUS "but CMake generates it automatically in the build directory.")
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakeincluded)
endif()
endif()
# Refer to prefix symbolically to ease relocation by end user,
# as Makefile-generated .pc file does.
if(INC_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/include")
set(PC_INC_INSTALL_DIR "\${prefix}/include")
else()
set(PC_INC_INSTALL_DIR "${INC_INSTALL_DIR}")
endif()
if(LIB_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/lib")
set(PC_LIB_INSTALL_DIR "\${exec_prefix}/lib")
else()
set(PC_LIB_INSTALL_DIR "${LIB_INSTALL_DIR}")
endif()
#============================================================================
# zlib
#============================================================================
set(ZLIB_PUBLIC_HDRS
${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h
zlib${SUFFIX}.h
)
set(ZLIB_PRIVATE_HDRS
adler32_p.h
chunkset_tpl.h
crc32_p.h
crc32_tbl.h
crc32_comb_tbl.h
deflate.h
deflate_p.h
functable.h
inffast.h
inffixed_tbl.h
inflate.h
inflate_p.h
inftrees.h
insert_string_tpl.h
match_tpl.h
trees.h
trees_emit.h
trees_tbl.h
zbuild.h
zendian.h
zutil.h
)
set(ZLIB_SRCS
adler32.c
chunkset.c
compare258.c
compress.c
crc32.c
crc32_comb.c
deflate.c
deflate_fast.c
deflate_huff.c
deflate_medium.c
deflate_quick.c
deflate_rle.c
deflate_slow.c
deflate_stored.c
functable.c
infback.c
inffast.c
inflate.c
inftrees.c
insert_string.c
insert_string_roll.c
slide_hash.c
trees.c
uncompr.c
zutil.c
)
set(ZLIB_GZFILE_PRIVATE_HDRS
gzguts.h
)
set(ZLIB_GZFILE_SRCS
gzlib.c
gzread.c
gzwrite.c
)
if(NOT MINGW AND NOT MSYS AND NOT CYGWIN)
set(ZLIB_DLL_SRCS
win32/zlib${SUFFIX}1.rc # If present will override custom build rule below.
)
endif()
if(MINGW OR MSYS OR CYGWIN)
# This gets us DLL resource information when compiling on MinGW.
if(NOT CMAKE_RC_COMPILER)
set(CMAKE_RC_COMPILER windres.exe)
endif()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
COMMAND ${CMAKE_RC_COMPILER}
-D GCC_WINDRES
-I ${CMAKE_CURRENT_SOURCE_DIR}
-I ${CMAKE_CURRENT_BINARY_DIR}
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib${SUFFIX}1.rc)
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
endif()
set(ZLIB_ALL_SRCS ${ZLIB_SRCS} ${ZLIB_ARCH_HDRS} ${ZLIB_ARCH_SRCS} ${ZLIB_DLL_SRCS}
${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
if(WITH_GZFILEOP)
list(APPEND ZLIB_ALL_SRCS ${ZLIB_GZFILE_PRIVATE_HDRS} ${ZLIB_GZFILE_SRCS})
endif()
if(NOT DEFINED BUILD_SHARED_LIBS)
add_library(zlib SHARED ${ZLIB_ALL_SRCS})
add_library(zlibstatic STATIC ${ZLIB_ALL_SRCS})
set(ZLIB_INSTALL_LIBRARIES zlib zlibstatic)
else()
add_library(zlib ${ZLIB_ALL_SRCS})
if(NOT BUILD_SHARED_LIBS)
add_library(zlibstatic ALIAS zlib)
endif()
set(ZLIB_INSTALL_LIBRARIES zlib)
endif()
foreach(ZLIB_INSTALL_LIBRARY ${ZLIB_INSTALL_LIBRARIES})
target_include_directories(${ZLIB_INSTALL_LIBRARY} PUBLIC
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
endforeach()
if(WIN32)
# Shared library
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
set_target_properties(zlib PROPERTIES OUTPUT_NAME zlib${SUFFIX})
endif()
# Static library
if(NOT DEFINED BUILD_SHARED_LIBS)
if(MSVC)
set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME zlibstatic${SUFFIX})
else()
set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z${SUFFIX})
endif()
elseif(NOT BUILD_SHARED_LIBS)
if(MSVC)
set_target_properties(zlib PROPERTIES OUTPUT_NAME zlibstatic${SUFFIX})
else()
set_target_properties(zlib PROPERTIES OUTPUT_NAME z${SUFFIX})
endif()
endif()
else()
# On unix-like platforms the library is almost always called libz
set_target_properties(${ZLIB_INSTALL_LIBRARIES} PROPERTIES OUTPUT_NAME z${SUFFIX})
endif()
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
if(ZLIB_COMPAT)
set(ZLIB_FULL_VERSION ${ZLIB_HEADER_VERSION}.zlib-ng)
set_target_properties(zlib PROPERTIES SOVERSION 1)
else()
set(ZLIB_FULL_VERSION ${ZLIBNG_HEADER_VERSION})
set_target_properties(zlib PROPERTIES SOVERSION 2)
endif()
if(NOT CYGWIN)
# This property causes shared libraries on Linux to have the full version
# encoded into their final filename. We disable this on Cygwin because
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
# seems to be the default.
#
# This has no effect with MSVC, on that platform the version info for
# the DLL comes from the resource file win32/zlib1.rc
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
endif()
if(UNIX)
if(HAVE_NO_INTERPOSITION)
set_target_properties(zlib PROPERTIES COMPILE_FLAGS "-fno-semantic-interposition")
endif()
if(NOT APPLE)
set_target_properties(zlib PROPERTIES LINK_FLAGS
"-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.map\"")
else()
# Match configure/make's behavior (i.e. don't use @rpath on mac).
set_target_properties(zlib PROPERTIES INSTALL_NAME_DIR "${LIB_INSTALL_DIR}")
endif()
endif()
if(MSYS OR CYGWIN)
# Suppress version number from shared library name
set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 0)
elseif(WIN32)
# Creates zlib1.dll when building shared library version
if(ZLIB_COMPAT)
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
else()
set_target_properties(zlib PROPERTIES SUFFIX "2.dll")
endif()
endif()
endif()
if(HAVE_UNISTD_H)
SET(ZCONF_UNISTD_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */")
else()
SET(ZCONF_UNISTD_LINE "#if 0 /* was set to #if 0 by configure/cmake/etc */")
endif()
if(NEED_PTRDIFF_T)
SET(ZCONF_PTRDIFF_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */")
else()
SET(ZCONF_PTRDIFF_LINE "#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */")