2010-05-11 19:44:00 +02:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# CMake file for zlib. See root CMakeLists.txt
|
|
|
|
#
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2012-02-24 14:53:22 +01:00
|
|
|
project(${ZLIB_LIBRARY} C)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2012-02-22 16:52:23 +01:00
|
|
|
include(CheckFunctionExists)
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
include(CheckCSourceCompiles)
|
2012-06-28 19:07:17 +02:00
|
|
|
include(CheckTypeSize)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
2012-02-22 16:52:23 +01:00
|
|
|
#
|
|
|
|
# Check for fseeko
|
|
|
|
#
|
|
|
|
check_function_exists(fseeko HAVE_FSEEKO)
|
|
|
|
if(NOT HAVE_FSEEKO)
|
|
|
|
add_definitions(-DNO_FSEEKO)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for unistd.h
|
|
|
|
#
|
|
|
|
check_include_file(unistd.h Z_HAVE_UNISTD_H)
|
2010-05-11 19:44:00 +02:00
|
|
|
|
|
|
|
if(MSVC)
|
2012-02-22 16:52:23 +01:00
|
|
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
|
|
|
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
2010-05-11 19:44:00 +02:00
|
|
|
endif()
|
|
|
|
|
2012-06-28 19:07:17 +02:00
|
|
|
#
|
|
|
|
# Check to see if we have large file support
|
|
|
|
#
|
|
|
|
check_type_size(off64_t OFF64_T)
|
|
|
|
if(HAVE_OFF64_T)
|
|
|
|
add_definitions(-D_LARGEFILE64_SOURCE=1)
|
|
|
|
endif()
|
|
|
|
|
2012-02-22 16:52:23 +01:00
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein"
|
2012-02-24 13:23:34 +01:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/zconf.h" @ONLY)
|
2012-03-03 16:49:23 +01:00
|
|
|
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
|
2012-02-22 16:52:23 +01:00
|
|
|
|
|
|
|
set(ZLIB_PUBLIC_HDRS
|
2012-02-24 13:23:34 +01:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/zconf.h"
|
2012-02-22 16:52:23 +01:00
|
|
|
zlib.h
|
|
|
|
)
|
|
|
|
set(ZLIB_PRIVATE_HDRS
|
|
|
|
crc32.h
|
|
|
|
deflate.h
|
|
|
|
gzguts.h
|
|
|
|
inffast.h
|
|
|
|
inffixed.h
|
|
|
|
inflate.h
|
|
|
|
inftrees.h
|
|
|
|
trees.h
|
|
|
|
zutil.h
|
|
|
|
)
|
|
|
|
set(ZLIB_SRCS
|
|
|
|
adler32.c
|
|
|
|
compress.c
|
|
|
|
crc32.c
|
|
|
|
deflate.c
|
|
|
|
gzclose.c
|
|
|
|
gzlib.c
|
|
|
|
gzread.c
|
|
|
|
gzwrite.c
|
|
|
|
inflate.c
|
|
|
|
infback.c
|
|
|
|
inftrees.c
|
|
|
|
inffast.c
|
|
|
|
trees.c
|
|
|
|
uncompr.c
|
|
|
|
zutil.c
|
|
|
|
)
|
|
|
|
|
2012-02-24 13:23:34 +01:00
|
|
|
add_library(${ZLIB_LIBRARY} STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
|
|
|
set_target_properties(${ZLIB_LIBRARY} PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
2012-02-22 16:52:23 +01:00
|
|
|
|
2010-05-11 19:44:00 +02:00
|
|
|
if(UNIX)
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2012-06-15 15:04:17 +02:00
|
|
|
ocv_warnings_disable(CMAKE_C_FLAGS /wd4013 -Wattributes -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations)
|
2012-02-22 21:22:29 +01:00
|
|
|
|
2012-02-24 13:23:34 +01:00
|
|
|
set_target_properties(${ZLIB_LIBRARY} PROPERTIES
|
|
|
|
OUTPUT_NAME ${ZLIB_LIBRARY}
|
2010-05-11 19:44:00 +02:00
|
|
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
2012-06-28 19:23:50 +02:00
|
|
|
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
2010-05-11 19:44:00 +02:00
|
|
|
)
|
2010-09-22 04:01:54 +02:00
|
|
|
|
2011-05-17 11:40:06 +02:00
|
|
|
if(ENABLE_SOLUTION_FOLDERS)
|
2012-02-24 13:23:34 +01:00
|
|
|
set_target_properties(${ZLIB_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
2011-05-11 15:37:20 +02:00
|
|
|
endif()
|
2012-06-15 15:04:17 +02:00
|
|
|
|
2010-12-05 00:02:36 +01:00
|
|
|
if(NOT BUILD_SHARED_LIBS)
|
2012-06-28 19:23:50 +02:00
|
|
|
install(TARGETS ${ZLIB_LIBRARY} ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main)
|
2010-12-05 00:02:36 +01:00
|
|
|
endif()
|
2012-04-09 13:32:28 +02:00
|
|
|
|
|
|
|
ocv_parse_header2(ZLIB "${CMAKE_CURRENT_SOURCE_DIR}/zlib.h" ZLIB_VERSION PARENT_SCOPE)
|
|
|
|
|