Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/3rdparty/zlib/CMakeLists.txt
16337 views
1
# ----------------------------------------------------------------------------
2
# CMake file for zlib. See root CMakeLists.txt
3
#
4
# ----------------------------------------------------------------------------
5
6
project(${ZLIB_LIBRARY} C)
7
8
include(CheckFunctionExists)
9
include(CheckIncludeFile)
10
include(CheckCSourceCompiles)
11
include(CheckTypeSize)
12
13
#
14
# Check for fseeko
15
#
16
check_function_exists(fseeko HAVE_FSEEKO)
17
if(NOT HAVE_FSEEKO)
18
add_definitions(-DNO_FSEEKO)
19
endif()
20
21
#
22
# Check for unistd.h
23
#
24
if(NOT MSVC)
25
check_include_file(unistd.h Z_HAVE_UNISTD_H)
26
if(Z_HAVE_UNISTD_H)
27
add_definitions(-DZ_HAVE_UNISTD_H)
28
endif()
29
endif()
30
31
if(MSVC)
32
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
33
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
34
endif()
35
36
#
37
# Check to see if we have large file support
38
#
39
check_type_size(off64_t OFF64_T)
40
if(HAVE_OFF64_T)
41
add_definitions(-D_LARGEFILE64_SOURCE=1)
42
endif()
43
44
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
45
46
set(ZLIB_PUBLIC_HDRS
47
zconf.h
48
zlib.h
49
)
50
set(ZLIB_PRIVATE_HDRS
51
crc32.h
52
deflate.h
53
gzguts.h
54
inffast.h
55
inffixed.h
56
inflate.h
57
inftrees.h
58
trees.h
59
zutil.h
60
)
61
set(ZLIB_SRCS
62
adler32.c
63
compress.c
64
crc32.c
65
deflate.c
66
gzclose.c
67
gzlib.c
68
gzread.c
69
gzwrite.c
70
inflate.c
71
infback.c
72
inftrees.c
73
inffast.c
74
trees.c
75
uncompr.c
76
zutil.c
77
)
78
79
add_library(${ZLIB_LIBRARY} STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
80
set_target_properties(${ZLIB_LIBRARY} PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
81
82
ocv_warnings_disable(CMAKE_C_FLAGS -Wshorten-64-to-32 -Wattributes -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wshift-negative-value
83
-Wundef # _LFS64_LARGEFILE is not defined
84
/wd4267 # MSVS 2015 (x64) + zlib 1.2.11
85
-Wimplicit-fallthrough
86
)
87
88
set_target_properties(${ZLIB_LIBRARY} PROPERTIES
89
OUTPUT_NAME ${ZLIB_LIBRARY}
90
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
91
COMPILE_PDB_NAME ${ZLIB_LIBRARY}
92
COMPILE_PDB_NAME_DEBUG "${ZLIB_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
93
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
94
)
95
96
if(ENABLE_SOLUTION_FOLDERS)
97
set_target_properties(${ZLIB_LIBRARY} PROPERTIES FOLDER "3rdparty")
98
endif()
99
100
if(NOT BUILD_SHARED_LIBS)
101
ocv_install_target(${ZLIB_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
102
endif()
103
104
ocv_install_3rdparty_licenses(zlib README)
105
106