2018-09-19 09:02:24 +00:00
|
|
|
project(miniz)
|
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
2019-05-23 09:49:43 +00:00
|
|
|
add_library(miniz INTERFACE)
|
2019-05-30 15:48:32 +00:00
|
|
|
|
2019-05-31 10:33:35 +00:00
|
|
|
if(NOT SLIC3R_STATIC OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
2019-05-23 13:39:43 +00:00
|
|
|
find_package(miniz 2.1 QUIET)
|
|
|
|
endif()
|
2019-05-23 09:49:43 +00:00
|
|
|
|
2019-05-23 13:39:43 +00:00
|
|
|
if(miniz_FOUND)
|
|
|
|
|
|
|
|
message(STATUS "Using system miniz...")
|
|
|
|
target_link_libraries(miniz INTERFACE miniz::miniz)
|
2019-05-23 09:49:43 +00:00
|
|
|
|
2019-05-23 13:39:43 +00:00
|
|
|
else()
|
2019-05-23 09:49:43 +00:00
|
|
|
|
2019-05-23 13:39:43 +00:00
|
|
|
add_library(miniz_static STATIC
|
|
|
|
miniz.c
|
|
|
|
miniz.h
|
|
|
|
)
|
|
|
|
|
2019-05-31 14:57:27 +00:00
|
|
|
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
|
2019-05-31 10:33:35 +00:00
|
|
|
target_compile_definitions(miniz_static PRIVATE _GNU_SOURCE)
|
|
|
|
endif()
|
|
|
|
|
2019-05-23 13:39:43 +00:00
|
|
|
target_link_libraries(miniz INTERFACE miniz_static)
|
|
|
|
target_include_directories(miniz INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
|
|
|
message(STATUS "Miniz NOT found in system, using bundled version...")
|
2019-05-23 09:49:43 +00:00
|
|
|
|
2019-05-23 13:39:43 +00:00
|
|
|
endif()
|