2016-01-07 10:37:00 +00:00
|
|
|
# ################################################################
|
2016-09-03 05:11:49 +00:00
|
|
|
# Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
|
2016-01-07 10:37:00 +00:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
2016-09-03 05:11:49 +00:00
|
|
|
# This source code is licensed under the BSD-style license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
2016-01-07 10:37:00 +00:00
|
|
|
# ################################################################
|
2016-01-10 11:20:52 +00:00
|
|
|
|
|
|
|
PROJECT(zstd)
|
2017-04-19 17:20:27 +00:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
|
2017-03-16 13:03:54 +00:00
|
|
|
SET(ZSTD_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../..")
|
2016-01-07 10:37:00 +00:00
|
|
|
|
2017-03-17 14:36:37 +00:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Add extra compilation flags
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
INCLUDE(CMakeModules/AddExtraCompilationFlags.cmake)
|
|
|
|
ADD_EXTRA_COMPILATION_FLAGS()
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Options
|
|
|
|
#-----------------------------------------------------------------------------
|
2016-01-07 10:37:00 +00:00
|
|
|
OPTION(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF)
|
2017-03-21 12:00:05 +00:00
|
|
|
IF (UNIX)
|
|
|
|
OPTION(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ON)
|
|
|
|
ELSE (UNIX)
|
|
|
|
OPTION(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" OFF)
|
|
|
|
ENDIF (UNIX)
|
2017-03-20 14:47:28 +00:00
|
|
|
OPTION(ZSTD_BUILD_PROGRAMS "BUILD PROGRAMS" ON)
|
2017-02-09 14:10:24 +00:00
|
|
|
OPTION(ZSTD_BUILD_CONTRIB "BUILD CONTRIB" OFF)
|
2017-03-20 14:47:28 +00:00
|
|
|
OPTION(ZSTD_BUILD_TESTS "BUILD TESTS" OFF)
|
2016-01-07 10:37:00 +00:00
|
|
|
|
|
|
|
IF (ZSTD_LEGACY_SUPPORT)
|
2016-01-10 11:20:52 +00:00
|
|
|
MESSAGE(STATUS "ZSTD_LEGACY_SUPPORT defined!")
|
2017-03-13 21:44:08 +00:00
|
|
|
ADD_DEFINITIONS(-DZSTD_LEGACY_SUPPORT=4)
|
2016-01-07 10:37:00 +00:00
|
|
|
ELSE (ZSTD_LEGACY_SUPPORT)
|
2016-01-10 11:20:52 +00:00
|
|
|
MESSAGE(STATUS "ZSTD_LEGACY_SUPPORT not defined!")
|
|
|
|
ADD_DEFINITIONS(-DZSTD_LEGACY_SUPPORT=0)
|
2016-01-07 10:37:00 +00:00
|
|
|
ENDIF (ZSTD_LEGACY_SUPPORT)
|
|
|
|
|
2017-03-17 14:36:37 +00:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Add source directories
|
|
|
|
#-----------------------------------------------------------------------------
|
2016-01-10 11:20:52 +00:00
|
|
|
ADD_SUBDIRECTORY(lib)
|
2017-03-20 14:47:28 +00:00
|
|
|
|
|
|
|
IF (ZSTD_BUILD_PROGRAMS)
|
|
|
|
ADD_SUBDIRECTORY(programs)
|
|
|
|
ENDIF (ZSTD_BUILD_PROGRAMS)
|
|
|
|
|
|
|
|
IF (ZSTD_BUILD_TESTS)
|
|
|
|
IF (NOT ZSTD_BUILD_STATIC)
|
|
|
|
MESSAGE(SEND_ERROR "You need to build static library to build tests")
|
|
|
|
ENDIF (NOT ZSTD_BUILD_STATIC)
|
|
|
|
|
|
|
|
ADD_SUBDIRECTORY(tests)
|
|
|
|
ENDIF (ZSTD_BUILD_TESTS)
|
|
|
|
|
2017-02-09 14:10:24 +00:00
|
|
|
IF (ZSTD_BUILD_CONTRIB)
|
|
|
|
ADD_SUBDIRECTORY(contrib)
|
|
|
|
ENDIF (ZSTD_BUILD_CONTRIB)
|
2016-01-07 10:37:00 +00:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
2017-03-17 14:36:37 +00:00
|
|
|
# Add clean-all target
|
2016-01-07 10:37:00 +00:00
|
|
|
#-----------------------------------------------------------------------------
|
2016-06-03 08:24:00 +00:00
|
|
|
ADD_CUSTOM_TARGET(clean-all
|
|
|
|
COMMAND ${CMAKE_BUILD_TOOL} clean
|
|
|
|
COMMAND rm -rf ${CMAKE_BINARY_DIR}/
|
|
|
|
)
|