zlib: move detection in root CMakeLists.txt
This commit is contained in:
parent
9ce3e42fa8
commit
4000e76080
@ -340,6 +340,20 @@ endif()
|
||||
|
||||
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
# zlib
|
||||
if(GMIO_USE_BUNDLED_ZLIB)
|
||||
message(STATUS "Bundled version of zlib")
|
||||
set(ZLIB_INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/zlib
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/3rdparty/zlib)
|
||||
set(ZLIB_LIBRARIES zlibstatic)
|
||||
else()
|
||||
find_package(ZLIB)
|
||||
if (NOT(ZLIB_VERSION_MAJOR EQUAL 1) AND NOT(ZLIB_VERSION_MINOR EQUAL 2))
|
||||
message(FATAL_ERROR "Incompatible zlib version ${ZLIB_VERSION_STRING} (gmio expects v1.2.x)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Sub-directories
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(tests)
|
||||
|
@ -100,20 +100,10 @@ endif()
|
||||
|
||||
# zlib
|
||||
if(GMIO_USE_BUNDLED_ZLIB)
|
||||
message(STATUS "Building bundled verison of zlib")
|
||||
add_subdirectory(3rdparty/zlib)
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/zlib
|
||||
${CMAKE_CURRENT_BINARY_DIR}/3rdparty/zlib)
|
||||
target_link_libraries(gmio zlibstatic)
|
||||
else()
|
||||
find_package(ZLIB)
|
||||
if (NOT(ZLIB_VERSION_MAJOR EQUAL 1) AND NOT(ZLIB_VERSION_MINOR EQUAL 2))
|
||||
message(FATAL_ERROR "Incompatible zlib version ${ZLIB_VERSION_STRING} (gmio expects v1.2.x)")
|
||||
endif()
|
||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
target_link_libraries(gmio ${ZLIB_LIBRARIES})
|
||||
endif()
|
||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
target_link_libraries(gmio ${ZLIB_LIBRARIES})
|
||||
|
||||
# Installs for target
|
||||
install(TARGETS gmio
|
||||
|
@ -76,7 +76,7 @@ enum gmio_error
|
||||
|
||||
/* zlib */
|
||||
/*! See \c Z_ERRNO (file operation error) */
|
||||
GMIO_ERROR_ZLIB_FILE_OPERATION = GMIO_ZLIB_ERROR_TAG + 0x01,
|
||||
GMIO_ERROR_ZLIB_ERRNO = GMIO_ZLIB_ERROR_TAG + 0x01,
|
||||
|
||||
/*! See \c Z_STREAM_ERROR */
|
||||
GMIO_ERROR_ZLIB_STREAM,
|
||||
|
Loading…
Reference in New Issue
Block a user