blob: 134e1447b42495eb69bb9a750eede491f552323e [file] [log] [blame]
# XXX: TODO
# 1. pkgconfig file not yet built.
# 2. installation not tested.
# 3. Problems generating html pages.
# 4. distribution tarball not checked for unwanted/missing content.
# 5. create usable libtool .la file
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(libzip C)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckTypeSize)
SET(PACKAGE "libzip")
SET(PACKAGE_NAME ${PACKAGE})
SET(PACKAGE_VERSION_MAJOR "0")
SET(PACKAGE_VERSION_MINOR "9")
SET(PACKAGE_VERSION_PATCH "0")
SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
SET(PACKAGE_VERSION ${VERSION})
SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
ADD_SUBDIRECTORY(lib)
ADD_SUBDIRECTORY(man)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(regress)
# Checks
CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO)
CHECK_FUNCTION_EXISTS(MoveFileEx HAVE_MOVEFILEEX)
CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H_LIBZIP)
CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H_LIBZIP)
CHECK_TYPE_SIZE(int8_t INT8_T_LIBZIP)
CHECK_TYPE_SIZE(uint8_t UINT8_T_LIBZIP)
CHECK_TYPE_SIZE(int16_t INT16_T_LIBZIP)
CHECK_TYPE_SIZE(uint16_t UINT16_T_LIBZIP)
CHECK_TYPE_SIZE(int32_t INT32_T_LIBZIP)
CHECK_TYPE_SIZE(uint32_t UINT32_T_LIBZIP)
CHECK_TYPE_SIZE(int64_t INT64_T_LIBZIP)
CHECK_TYPE_SIZE(uint64_t UINT64_T_LIBZIP)
CHECK_TYPE_SIZE(short SHORT_LIBZIP)
CHECK_TYPE_SIZE(int INT_LIBZIP)
CHECK_TYPE_SIZE(long LONG_LIBZIP)
CHECK_TYPE_SIZE("long long" LONGLONG_LIBZIP)
FIND_PACKAGE(ZLIB REQUIRED)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
CHECK_SYMBOL_EXISTS(ZEXPORT zlib.h HAVE_ZEXPORT)
IF(NOT HAVE_ZEXPORT)
MESSAGE(FATAL_ERROR "-- ZLIB version too old, please install at least v1.1.2")
ENDIF(NOT HAVE_ZEXPORT)
# Targets
# XXX: pkgconfig file
# installation
# XXX: pkgconfig file
# packaging
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "library for manipulating zip archives")
SET(CPACK_PACKAGE_VENDOR "Dieter Baron <dillo@giga.or.at> and Thomas Klausner <tk@giga.or.at>")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION_PATCH})
SET(CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION})
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_SOURCE_IGNORE_FILES
".a$"
".cmake$"
".o$"
".so$"
"/.deps/"
"/.libs/"
"/CMakeFiles/"
"/CVS/"
"/autom4te.cache/"
"/build"
"/broken"
"/docs/"
"AdditionalInfo.txt$"
"CMakeCache.txt$"
"Makefile$"
"\\\\.sh$"
"_CPack_"
"config.h$"
"config.log$"
"config.status$"
"dccsend$"
"dccserver$"
"html$"
"install_manifest.txt$"
"stamp-h1$"
"tar.bz2"
"tar.gz"
"~$"
)
SET(CPACK_SOURCE_STRIP_FILES "")
INCLUDE(CPack)
# write out config file
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake-config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake-zipconf.h.in
${CMAKE_CURRENT_BINARY_DIR}/zipconf.h)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zipconf.h DESTINATION lib/libzip/include)