• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# cmake file for zlib
2
3if (NOT DE_DEFS)
4	message(FATAL_ERROR "Include Defs.cmake")
5endif ()
6
7if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/zlib.h")
8	set(DEFAULT_ZLIB_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src)
9else ()
10	# Assume build inside Android source tree
11	set(DEFAULT_ZLIB_SRC_PATH "../zlib/src")
12endif ()
13
14set(ZLIB_SRC_PATH ${DEFAULT_ZLIB_SRC_PATH} CACHE STRING "Path to zlib source tree")
15
16if (IS_ABSOLUTE ${ZLIB_SRC_PATH})
17	set(ZLIB_ABS_PATH ${ZLIB_SRC_PATH})
18else ()
19	set(ZLIB_ABS_PATH "${CMAKE_SOURCE_DIR}/${ZLIB_SRC_PATH}")
20endif ()
21
22set(ZLIB_SRCS
23	${ZLIB_ABS_PATH}/adler32.c
24	${ZLIB_ABS_PATH}/compress.c
25	${ZLIB_ABS_PATH}/crc32.c
26	${ZLIB_ABS_PATH}/crc32.h
27	${ZLIB_ABS_PATH}/deflate.c
28	${ZLIB_ABS_PATH}/deflate.h
29	${ZLIB_ABS_PATH}/gzclose.c
30	${ZLIB_ABS_PATH}/gzguts.h
31	${ZLIB_ABS_PATH}/gzlib.c
32	${ZLIB_ABS_PATH}/gzread.c
33	${ZLIB_ABS_PATH}/gzwrite.c
34	${ZLIB_ABS_PATH}/infback.c
35	${ZLIB_ABS_PATH}/inffast.c
36	${ZLIB_ABS_PATH}/inffast.h
37	${ZLIB_ABS_PATH}/inffixed.h
38	${ZLIB_ABS_PATH}/inflate.c
39	${ZLIB_ABS_PATH}/inflate.h
40	${ZLIB_ABS_PATH}/inftrees.c
41	${ZLIB_ABS_PATH}/inftrees.h
42	${ZLIB_ABS_PATH}/trees.c
43	${ZLIB_ABS_PATH}/trees.h
44	${ZLIB_ABS_PATH}/uncompr.c
45	${ZLIB_ABS_PATH}/zconf.h
46	${ZLIB_ABS_PATH}/zlib.h
47	${ZLIB_ABS_PATH}/zutil.c
48	${ZLIB_ABS_PATH}/zutil.h
49	)
50
51if (DE_COMPILER_IS_MSC)
52	# 4127: conditional expression is constant
53	# 4131: 'x': uses old style declarator
54	# 4242, 4244: conversion from 'x' to 'y', possible loss of data
55	# 4996: deprecated POSIX name
56	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall /wd4127 /wd4131 /wd4242 /wd4244 /wd4996")
57
58elseif (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG)
59	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration")
60
61endif ()
62
63if (DE_OS_IS_UNIX OR DE_OS_IS_QNX)
64	add_definitions(-D_XOPEN_SOURCE=600)
65endif ()
66
67set(CMAKE_C_FLAGS ${DE_3RD_PARTY_C_FLAGS})
68
69add_library(z STATIC ${ZLIB_SRCS})
70
71set(ZLIB_INCLUDE_PATH	${ZLIB_ABS_PATH}	PARENT_SCOPE)
72set(ZLIB_LIBRARY		z					PARENT_SCOPE)
73