Commit 7a1c1c27 authored by Samuel Debionne's avatar Samuel Debionne

Add version checking for lz4 library

parent 5885a146
Pipeline #3754 passed with stages
in 5 minutes and 52 seconds
......@@ -39,6 +39,11 @@ include(LimaTools)
find_package(Threads REQUIRED)
if(MSVC AND MSVC_VERSION GREATER 1500)
# Compiler specific (parallel build)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
if(UNIX)
#--------------------------------------------------------------------------------
......@@ -294,12 +299,12 @@ endif()
if(LIMA_ENABLE_EDFLZ4)
find_package(LZ4)
if (LZ4_FOUND)
if (${LZ4_FOUND})
add_definitions(-DWITH_LZ4_COMPRESSION)
set(saving_libs ${saving_libs} ${LZ4_LIBRARIES})
set(saving_includes ${saving_includes} ${LZ4_INCLUDE_DIRS})
else()
message(FATAL_ERROR "LZ4 library: required version = 1.7.x, please update or switch off LIMA_ENABLE_EDFLZ4")
message(FATAL_ERROR "LZ4 library: required version = 1.8.2, please update or switch off LIMA_ENABLE_EDFLZ4")
endif()
endif()
......
find_library(LZ4_LIBRARIES NAMES lz4)
find_path(LZ4_INCLUDE_DIRS NAMES lz4.h)
find_library(LZ4_LIBRARIES NAMES lz4)
# We require LZ4_compress_default() which was added in v1.8.2
if (LZ4_LIBRARIES)
include(CheckCSourceRuns)
set(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${LZ4_LIBRARY})
check_c_source_runs("
#include <lz4.h>
int main() {
int good = (LZ4_VERSION_MAJOR > 1) ||
((LZ4_VERSION_MAJOR == 1) && (LZ4_VERSION_MINOR >= 8) && (LZ4_VERSION_RELEASE >= 2));
return !good;
}" LZ4_GOOD_VERSION)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LZ4
DEFAULT_MSG
LZ4_LIBRARIES
LZ4_INCLUDE_DIRS)
LZ4_INCLUDE_DIRS
LZ4_GOOD_VERSION)
mark_as_advanced(LZ4_INCLUDE_DIRS LZ4_LIBRARIES)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment