Cdroid/cmake/modules/FindZLIB.cmake

30 lines
898 B
CMake
Raw Normal View History

2022-11-23 08:41:59 +08:00
find_package(PkgConfig)
pkg_check_modules(PC_ZLIB zlib)
2022-11-23 08:41:59 +08:00
find_path(ZLIB_INCLUDE_DIRS
2022-11-23 08:41:59 +08:00
NAMES zlib.h
HINTS ${PC_ZLIB_INCLUDEDIR}
${PC_ZLIB_INCLUDE_DIRS}
)
find_library(ZLIB_LIBRARIES
NAMES z
2022-11-23 08:41:59 +08:00
HINTS ${PC_ZLIB_LIBDIR}
${PC_ZLIB_LIBRARY_DIRS}
)
#message("ZLIB_LIBRARIES=${ZLIB_LIBRARIES} ZLIB_INCLUDE_DIRS=${ZLIB_INCLUDE_DIRS} PC_ZLIB_VERSION=${PC_ZLIB_VERSION}")
if(ZLIB_INCLUDE_DIRS AND ZLIB_LIBRARIES)
set(ZLIB_FOUND TRUE)
set(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
set(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS})
set(ZLIB_VERSION ${PC_ZLIB_VERSION})
endif()
2022-11-23 08:41:59 +08:00
include(FindPackageHandleStandardArgs)
2022-12-24 14:50:32 +08:00
FIND_PACKAGE_HANDLE_STANDARD_ARGS(zlib FOUND_VAR ZLIB_FOUND VERSION_VAR ZLIB_VERSION
REQUIRED_VARS ZLIB_INCLUDE_DIRS ZLIB_INCLUDE_DIR ZLIB_LIBRARIES ZLIB_LIBRARY)
2022-11-23 08:41:59 +08:00
mark_as_advanced(ZLIB_LIBRARIES ZLIB_LIBRARY ZLIB_INCLUDE_DIRS ZLIB_INCLUDE_DIR ZLIB_FOUND ZLIB_VERSION)
2022-11-23 08:41:59 +08:00