CMake 2.8.8 final test;
This commit is contained in:
parent
14148bd9c0
commit
0b7c10121e
13
.travis.yml
13
.travis.yml
@ -1,8 +1,9 @@
|
||||
language: c
|
||||
|
||||
before_install:
|
||||
- "wget -q http://ftp.lfs-matrix.net/pub/blfs/conglomeration/cmake/cmake-2.8.11.tar.gz"
|
||||
- "tar -xzvf cmake-2.8.11.tar.gz"
|
||||
- "wget https://launchpad.net/ubuntu/+source/cmake/2.8.8-2ubuntu1/+build/3441442/+files/cmake_2.8.8-2ubuntu1_amd64.deb"
|
||||
- "wget https://launchpad.net/ubuntu/+archive/primary/+files/cmake-data_2.8.8-2ubuntu1_all.deb"
|
||||
- "sudo apt-get remove cmake-data cmake"
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq gcc-arm-linux-gnueabi
|
||||
- sudo apt-get install -qq clang
|
||||
@ -11,11 +12,7 @@ before_install:
|
||||
- sudo apt-get install -qq valgrind
|
||||
|
||||
install:
|
||||
- "cd cmake-2.8.11"
|
||||
- "./bootstrap --prefix=/usr --system-libs --mandir=/share/man"
|
||||
- "make -j 16"
|
||||
- "sudo make install -j 16"
|
||||
- "cd .."
|
||||
- "sudo dpkg --install cmake-data_2.8.8-2ubuntu1_all.deb cmake_2.8.8-2ubuntu1_amd64.deb"
|
||||
|
||||
env:
|
||||
- ZSTD_TRAVIS_CI_ENV=travis-install
|
||||
@ -37,4 +34,4 @@ script:
|
||||
- make $ZSTD_TRAVIS_CI_ENV
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
fast_finish: true
|
@ -32,7 +32,7 @@
|
||||
# ################################################################
|
||||
|
||||
PROJECT(zstd)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
|
||||
|
||||
OPTION(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF)
|
||||
|
||||
@ -44,6 +44,15 @@ ELSE (ZSTD_LEGACY_SUPPORT)
|
||||
ADD_DEFINITIONS(-DZSTD_LEGACY_SUPPORT=0)
|
||||
ENDIF (ZSTD_LEGACY_SUPPORT)
|
||||
|
||||
INCLUDE(CMakeModules/CompareVersion.cmake)
|
||||
COMPARE_VERSION_STRINGS("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" "2.8.8" CMP_RESULT)
|
||||
|
||||
IF ((CMP_RESULT LESS 0) OR (CMP_RESULT EQUAL 0))
|
||||
SET(USE_DEPRECATED_CODE_STYLE TRUE)
|
||||
ELSE ()
|
||||
SET(USE_DEPRECATED_CODE_STYLE FALSE)
|
||||
ENDIF ((CMP_RESULT LESS 0) OR (CMP_RESULT EQUAL 0))
|
||||
|
||||
ADD_SUBDIRECTORY(lib)
|
||||
ADD_SUBDIRECTORY(programs)
|
||||
|
||||
|
70
contrib/cmake/CMakeModules/CompareVersion.cmake
Normal file
70
contrib/cmake/CMakeModules/CompareVersion.cmake
Normal file
@ -0,0 +1,70 @@
|
||||
# Computes the realtionship between two version strings. A version
|
||||
# string is a number delineated by '.'s such as 1.3.2 and 0.99.9.1.
|
||||
# You can feed version strings with different number of dot versions,
|
||||
# and the shorter version number will be padded with zeros: 9.2 <
|
||||
# 9.2.1 will actually compare 9.2.0 < 9.2.1.
|
||||
#
|
||||
# Input: a_in - value, not variable
|
||||
# b_in - value, not variable
|
||||
# result_out - variable with value:
|
||||
# -1 : a_in < b_in
|
||||
# 0 : a_in == b_in
|
||||
# 1 : a_in > b_in
|
||||
#
|
||||
# Written by James Bigler.
|
||||
MACRO(COMPARE_VERSION_STRINGS a_in b_in result_out)
|
||||
# Since SEPARATE_ARGUMENTS using ' ' as the separation token,
|
||||
# replace '.' with ' ' to allow easy tokenization of the string.
|
||||
STRING(REPLACE "." " " a ${a_in})
|
||||
STRING(REPLACE "." " " b ${b_in})
|
||||
SEPARATE_ARGUMENTS(a)
|
||||
SEPARATE_ARGUMENTS(b)
|
||||
|
||||
# Check the size of each list to see if they are equal.
|
||||
LIST(LENGTH a a_length)
|
||||
LIST(LENGTH b b_length)
|
||||
|
||||
# Pad the shorter list with zeros.
|
||||
|
||||
# Note that range needs to be one less than the length as the for
|
||||
# loop is inclusive (silly CMake).
|
||||
IF (a_length LESS b_length)
|
||||
# a is shorter
|
||||
SET(shorter a)
|
||||
MATH(EXPR range "${b_length} - 1")
|
||||
MATH(EXPR pad_range "${b_length} - ${a_length} - 1")
|
||||
ELSE (a_length LESS b_length)
|
||||
# b is shorter
|
||||
SET(shorter b)
|
||||
MATH(EXPR range "${a_length} - 1")
|
||||
MATH(EXPR pad_range "${a_length} - ${b_length} - 1")
|
||||
ENDIF (a_length LESS b_length)
|
||||
|
||||
# PAD out if we need to
|
||||
IF (NOT pad_range LESS 0)
|
||||
FOREACH (pad RANGE ${pad_range})
|
||||
# Since shorter is an alias for b, we need to get to it by by dereferencing shorter.
|
||||
LIST(APPEND ${shorter} 0)
|
||||
ENDFOREACH (pad RANGE ${pad_range})
|
||||
ENDIF (NOT pad_range LESS 0)
|
||||
|
||||
SET(result 0)
|
||||
FOREACH (index RANGE ${range})
|
||||
IF (result EQUAL 0)
|
||||
# Only continue to compare things as long as they are equal
|
||||
LIST(GET a ${index} a_version)
|
||||
LIST(GET b ${index} b_version)
|
||||
# LESS
|
||||
IF (a_version LESS b_version)
|
||||
SET(result -1)
|
||||
ENDIF (a_version LESS b_version)
|
||||
# GREATER
|
||||
IF (a_version GREATER b_version)
|
||||
SET(result 1)
|
||||
ENDIF (a_version GREATER b_version)
|
||||
ENDIF (result EQUAL 0)
|
||||
ENDFOREACH (index)
|
||||
|
||||
# Copy out the return result
|
||||
SET(${result_out} ${result})
|
||||
ENDMACRO(COMPARE_VERSION_STRINGS)
|
@ -31,9 +31,11 @@
|
||||
# - Public forum : https://groups.google.com/forum/#!forum/lz4c
|
||||
# ################################################################
|
||||
|
||||
if (POLICY CMP0021)
|
||||
cmake_policy(SET CMP0021 OLD)
|
||||
endif ()
|
||||
IF (USE_DEPRECATED_CODE_STYLE)
|
||||
IF (POLICY CMP0021)
|
||||
cmake_policy(SET CMP0021 OLD)
|
||||
ENDIF ()
|
||||
ENDIF (USE_DEPRECATED_CODE_STYLE)
|
||||
|
||||
# Get library version based on information from input content (use regular exp)
|
||||
function(GetLibraryVersion _content _outputVar1 _outputVar2 _outputVar3)
|
||||
@ -113,20 +115,16 @@ IF (MSVC)
|
||||
SET_TARGET_PROPERTIES(libzstd_shared PROPERTIES COMPILE_DEFINITIONS "ZSTD_DLL_EXPORT=1;ZSTD_HEAPMODE=0;_CONSOLE;_CRT_SECURE_NO_WARNINGS")
|
||||
ENDIF (MSVC)
|
||||
|
||||
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 2.8.11)
|
||||
#CMake version less 2.8.11... Use workaround hacks!
|
||||
ELSE ()
|
||||
IF (NOT USE_DEPRECATED_CODE_STYLE)
|
||||
TARGET_INCLUDE_DIRECTORIES(libzstd_static PUBLIC ${LIBRARY_DIR})
|
||||
TARGET_INCLUDE_DIRECTORIES(libzstd_shared PUBLIC ${LIBRARY_DIR})
|
||||
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 2.8.11)
|
||||
ENDIF (NOT USE_DEPRECATED_CODE_STYLE)
|
||||
|
||||
IF (ZSTD_LEGACY_SUPPORT)
|
||||
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 2.8.11)
|
||||
#CMake version less 2.8.11... Use workaround hacks!
|
||||
ELSE ()
|
||||
IF (NOT USE_DEPRECATED_CODE_STYLE)
|
||||
TARGET_INCLUDE_DIRECTORIES(libzstd_static PUBLIC ${LIBRARY_LEGACY_DIR})
|
||||
TARGET_INCLUDE_DIRECTORIES(libzstd_shared PUBLIC ${LIBRARY_LEGACY_DIR})
|
||||
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 2.8.11)
|
||||
ENDIF (NOT USE_DEPRECATED_CODE_STYLE)
|
||||
ENDIF (ZSTD_LEGACY_SUPPORT)
|
||||
|
||||
# Define library base name
|
||||
|
@ -42,21 +42,19 @@ SET(ROOT_DIR ../../..)
|
||||
SET(PROGRAMS_DIR ${ROOT_DIR}/programs)
|
||||
INCLUDE_DIRECTORIES(${PROGRAMS_DIR})
|
||||
|
||||
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 2.8.11)
|
||||
#CMake version less 2.8.11... Use workaround hacks!
|
||||
IF (USE_DEPRECATED_CODE_STYLE)
|
||||
# Define library directory, where sources and header files are located
|
||||
SET(LIBRARY_DIR ${ROOT_DIR}/lib)
|
||||
INCLUDE_DIRECTORIES(${LIBRARY_DIR})
|
||||
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 2.8.11)
|
||||
ENDIF (USE_DEPRECATED_CODE_STYLE)
|
||||
|
||||
IF (ZSTD_LEGACY_SUPPORT)
|
||||
SET(PROGRAMS_LEGACY_DIR ${PROGRAMS_DIR}/legacy)
|
||||
INCLUDE_DIRECTORIES(${PROGRAMS_LEGACY_DIR})
|
||||
|
||||
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 2.8.11)
|
||||
#CMake version less 2.8.11... Use workaround hacks!
|
||||
IF (USE_DEPRECATED_CODE_STYLE)
|
||||
INCLUDE_DIRECTORIES(${LIBRARY_DIR}/legacy)
|
||||
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 2.8.11)
|
||||
ENDIF (USE_DEPRECATED_CODE_STYLE)
|
||||
|
||||
SET(ZSTD_FILEIO_LEGACY ${PROGRAMS_LEGACY_DIR}/fileio_legacy.c)
|
||||
ENDIF (ZSTD_LEGACY_SUPPORT)
|
||||
|
Loading…
Reference in New Issue
Block a user