Cdroid/cmake/modules/FindZLIB.cmake
2022-12-24 06:50:32 +00:00

30 lines
898 B
CMake
Executable File

find_package(PkgConfig)
pkg_check_modules(PC_ZLIB zlib)
find_path(ZLIB_INCLUDE_DIRS
NAMES zlib.h
HINTS ${PC_ZLIB_INCLUDEDIR}
${PC_ZLIB_INCLUDE_DIRS}
)
find_library(ZLIB_LIBRARIES
NAMES z
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()
include(FindPackageHandleStandardArgs)
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)
mark_as_advanced(ZLIB_LIBRARIES ZLIB_LIBRARY ZLIB_INCLUDE_DIRS ZLIB_INCLUDE_DIR ZLIB_FOUND ZLIB_VERSION)