cmake: Add zlib support
This commit is contained in:
parent
c6140b4756
commit
5dd030882d
@ -110,6 +110,21 @@ file(GLOB CURL_BIN_FILES
|
||||
"${CURL_INCLUDE_DIR}/bin/curl*.dll"
|
||||
)
|
||||
|
||||
if (ZLIB_LIB)
|
||||
GET_FILENAME_COMPONENT(ZLIB_BIN_PATH ${ZLIB_LIB} PATH)
|
||||
endif()
|
||||
file(GLOB ZLIB_BIN_FILES
|
||||
"${ZLIB_BIN_PATH}/zlib*.dll")
|
||||
|
||||
if (NOT ZLIB_BIN_FILES)
|
||||
file(GLOB ZLIB_BIN_FILES
|
||||
"${ZLIB_INCLUDE_DIR}/../bin${_bin_suffix}/zlib*.dll"
|
||||
"${ZLIB_INCLUDE_DIR}/../bin/zlib*.dll"
|
||||
"${ZLIB_INCLUDE_DIR}/bin${_bin_suffix}/zlib*.dll"
|
||||
"${ZLIB_INCLUDE_DIR}/bin/zlib*.dll"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CONFIGURATION_TYPES MATCHES "Debug")
|
||||
file(GLOB QT_DEBUG_BIN_FILES
|
||||
"${Qt5Core_DIR}/../../../bin/Qt5Cored.dll"
|
||||
@ -139,6 +154,7 @@ set(ALL_BASE_BIN_FILES
|
||||
${FFMPEG_BIN_FILES}
|
||||
${X264_BIN_FILES}
|
||||
${CURL_BIN_FILES}
|
||||
${ZLIB_BIN_FILES}
|
||||
${LIBFDK_BIN_FILES}
|
||||
${FREETYPE_BIN_FILES}
|
||||
${QT_ICU_BIN_FILES})
|
||||
@ -170,6 +186,7 @@ message(STATUS "x264 files: ${X264_BIN_FILES}")
|
||||
message(STATUS "Libfdk files: ${LIBFDK_BIN_FILES}")
|
||||
message(STATUS "Freetype files: ${FREETYPE_BIN_FILES}")
|
||||
message(STATUS "curl files: ${CURL_BIN_FILES}")
|
||||
message(STATUS "zlib files: ${ZLIB_BIN_FILES}")
|
||||
message(STATUS "QT Debug files: ${QT_DEBUG_BIN_FILES}")
|
||||
message(STATUS "QT Debug Platform files: ${QT_DEBUG_PLAT_BIN_FILES}")
|
||||
message(STATUS "QT Release files: ${QT_BIN_FILES}")
|
||||
|
68
cmake/Modules/FindZLIB.cmake
Normal file
68
cmake/Modules/FindZLIB.cmake
Normal file
@ -0,0 +1,68 @@
|
||||
# Once done these will be defined:
|
||||
#
|
||||
# ZLIB_FOUND
|
||||
# ZLIB_INCLUDE_DIRS
|
||||
# ZLIB_LIBRARIES
|
||||
#
|
||||
# For use in OBS:
|
||||
#
|
||||
# ZLIB_INCLUDE_DIR
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_ZLIB QUIET zlib)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_lib_suffix 64)
|
||||
else()
|
||||
set(_lib_suffix 32)
|
||||
endif()
|
||||
|
||||
find_path(ZLIB_INCLUDE_DIR
|
||||
NAMES zlib.h
|
||||
HINTS
|
||||
ENV zlibPath${_lib_suffix}
|
||||
ENV zlibPath
|
||||
ENV DepsPath${_lib_suffix}
|
||||
ENV DepsPath
|
||||
${zlibPath${_lib_suffix}}
|
||||
${zlibPath}
|
||||
${DepsPath${_lib_suffix}}
|
||||
${DepsPath}
|
||||
${_ZLIB_INCLUDE_DIRS}
|
||||
PATHS
|
||||
/usr/include /usr/local/include /opt/local/include /sw/include
|
||||
PATH_SUFFIXES
|
||||
include)
|
||||
|
||||
find_library(ZLIB_LIB
|
||||
NAMES ${_ZLIB_LIBRARIES} z zlib zdll zlib1 zlibd zlibd1 libzlib libz
|
||||
HINTS
|
||||
ENV zlibPath${_lib_suffix}
|
||||
ENV zlibPath
|
||||
ENV DepsPath${_lib_suffix}
|
||||
ENV DepsPath
|
||||
${zlibPath${_lib_suffix}}
|
||||
${zlibPath}
|
||||
${DepsPath${_lib_suffix}}
|
||||
${DepsPath}
|
||||
${_ZLIB_LIBRARY_DIRS}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||
PATH_SUFFIXES
|
||||
lib${_lib_suffix} lib
|
||||
libs${_lib_suffix} libs
|
||||
bin${_lib_suffix} bin
|
||||
../lib${_lib_suffix} ../lib
|
||||
../libs${_lib_suffix} ../libs
|
||||
../bin${_lib_suffix} ../bin)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(zlib DEFAULT_MSG ZLIB_LIB ZLIB_INCLUDE_DIR)
|
||||
mark_as_advanced(ZLIB_INCLUDE_DIR ZLIB_LIB)
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
|
||||
set(ZLIB_LIBRARIES ${ZLIB_LIB})
|
||||
endif()
|
Loading…
x
Reference in New Issue
Block a user