Warning, /education/marble/src/3rdparty/zlib/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) 0002 0003 set(ZLIB_VERSION "1.2.8") 0004 0005 include(CheckTypeSize) 0006 include(CheckFunctionExists) 0007 include(CheckIncludeFile) 0008 include(CheckCSourceCompiles) 0009 0010 check_include_file(sys/types.h HAVE_SYS_TYPES_H) 0011 check_include_file(stdint.h HAVE_STDINT_H) 0012 check_include_file(stddef.h HAVE_STDDEF_H) 0013 0014 # 0015 # Check to see if we have large file support 0016 # 0017 set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) 0018 # We add these other definitions here because CheckTypeSize.cmake 0019 # in CMake 2.4.x does not automatically do so and we want 0020 # compatibility with CMake 2.4.x. 0021 if(HAVE_SYS_TYPES_H) 0022 list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) 0023 endif() 0024 if(HAVE_STDINT_H) 0025 list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) 0026 endif() 0027 if(HAVE_STDDEF_H) 0028 list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) 0029 endif() 0030 check_type_size(off64_t OFF64_T) 0031 if(HAVE_OFF64_T) 0032 add_definitions(-D_LARGEFILE64_SOURCE=1) 0033 endif() 0034 set(CMAKE_REQUIRED_DEFINITIONS) # clear variable 0035 0036 # 0037 # Check for fseeko 0038 # 0039 check_function_exists(fseeko HAVE_FSEEKO) 0040 if(NOT HAVE_FSEEKO) 0041 add_definitions(-DNO_FSEEKO) 0042 endif() 0043 0044 # 0045 # Check for unistd.h 0046 # 0047 check_include_file(unistd.h Z_HAVE_UNISTD_H) 0048 0049 if(MSVC) 0050 add_definitions(-D_CRT_SECURE_NO_DEPRECATE) 0051 add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) 0052 include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 0053 endif() 0054 0055 if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) 0056 # If we're doing an out of source build and the user has a zconf.h 0057 # in their source tree... 0058 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) 0059 message(STATUS "Renaming") 0060 message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h") 0061 message(STATUS "to 'zconf.h.included' because this file is included with zlib") 0062 message(STATUS "but CMake generates it automatically in the build directory.") 0063 file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included) 0064 endif() 0065 endif() 0066 0067 set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) 0068 configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein 0069 ${ZLIB_PC} @ONLY) 0070 configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein 0071 ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) 0072 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) 0073 0074 0075 #============================================================================ 0076 # zlib 0077 #============================================================================ 0078 0079 set(ZLIB_PUBLIC_HDRS 0080 ${CMAKE_CURRENT_BINARY_DIR}/zconf.h 0081 zlib.h 0082 ) 0083 set(ZLIB_PRIVATE_HDRS 0084 crc32.h 0085 deflate.h 0086 gzguts.h 0087 inffast.h 0088 inffixed.h 0089 inflate.h 0090 inftrees.h 0091 trees.h 0092 zutil.h 0093 ) 0094 set(ZLIB_SRCS 0095 adler32.c 0096 compress.c 0097 crc32.c 0098 deflate.c 0099 gzclose.c 0100 gzlib.c 0101 gzread.c 0102 gzwrite.c 0103 inflate.c 0104 infback.c 0105 inftrees.c 0106 inffast.c 0107 trees.c 0108 uncompr.c 0109 zutil.c 0110 ) 0111 0112 # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION 0113 file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) 0114 string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" 0115 "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) 0116 0117 add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) 0118 0119 if(UNIX) 0120 # On unix-like platforms the library is almost always called libz 0121 set_target_properties(zlibstatic PROPERTIES OUTPUT_NAME z) 0122 endif()