Add lzma and zlib support to cmake build system

cmake 2.8.9 needed for FindLibLZMA
This commit is contained in:
Milan Ševčík 2017-04-19 19:20:27 +02:00
parent e847730452
commit 522df42e10
2 changed files with 28 additions and 1 deletions

View File

@ -8,7 +8,7 @@
# ################################################################
PROJECT(zstd)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
SET(ZSTD_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../..")
#-----------------------------------------------------------------------------

View File

@ -64,3 +64,30 @@ IF (ZSTD_MULTITHREAD_SUPPORT)
ADD_CUSTOM_COMMAND(TARGET zstd POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink zstd zstdmt COMMENT "Creating zstdmt symlink")
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zstdmt DESTINATION "bin")
ENDIF (ZSTD_MULTITHREAD_SUPPORT)
OPTION(ZSTD_ZLIB_SUPPORT "ZLIB SUPPORT" OFF)
OPTION(ZSTD_LZMA_SUPPORT "LZMA SUPPORT" OFF)
IF (ZSTD_ZLIB_SUPPORT)
FIND_PACKAGE(ZLIB REQUIRED)
IF (ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(zstd ${ZLIB_LIBRARIES})
SET_TARGET_PROPERTIES(zstd PROPERTIES COMPILE_DEFINITIONS "ZSTD_GZCOMPRESS;ZSTD_GZDECOMPRESS")
ELSE ()
MESSAGE(SEND_ERROR "zlib library is missing")
ENDIF ()
ENDIF ()
IF (ZSTD_LZMA_SUPPORT)
FIND_PACKAGE(LibLZMA REQUIRED)
IF (LIBLZMA_FOUND)
INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(zstd ${LIBLZMA_LIBRARIES})
SET_TARGET_PROPERTIES(zstd PROPERTIES COMPILE_DEFINITIONS "ZSTD_LZMACOMPRESS;ZSTD_LZMADECOMPRESS")
ELSE ()
MESSAGE(SEND_ERROR "lzma library is missing")
ENDIF ()
ENDIF ()