Cdroid/cmake/modules/FindZIP.cmake
2022-12-07 01:30:22 +00:00

30 lines
828 B
CMake
Executable File

find_package(PkgConfig)
pkg_check_modules(PC_ZIP libzip)
find_path(ZIP_INCLUDE_DIRS
NAMES zip.h
HINTS ${PC_ZIP_INCLUDEDIR}
${PC_ZIP_INCLUDE_DIRS}
)
find_library(ZIP_LIBRARIES
NAMES zip
HINTS ${PC_ZIP_LIBDIR}
${PC_ZIP_LIBRARY_DIRS}
)
message("ZIP_LIBRARIES=${ZIP_LIBRARIES} ZIP_INCLUDE_DIRS=${ZIP_INCLUDE_DIRS} PC_ZIP_VERSION=${PC_ZIP_VERSION}")
if(ZIP_INCLUDE_DIRS AND ZIP_LIBRARIES)
set(ZIP_FOUND TRUE)
set(ZIP_LIBRARY ${ZIP_LIBRARIES})
set(ZIP_INCLUDE_DIR ${ZIP_INCLUDE_DIRS})
set(ZIP_VERSION ${PC_ZIP_VERSION})
endif()
include(FindPackageHandleStandardArgs)
#FIND_PACKAGE_HANDLE_STANDARD_ARGS(zlib REQUIRED_VARS ZIP_INCLUDE_DIRS ZIP_LIBRARIES
# FOUND_VAR ZIP_FOUND VERSION_VAR ZIP_VERSION)
mark_as_advanced(ZIP_LIBRARIES ZIP_LIBRARY ZIP_INCLUDE_DIRS ZIP_INCLUDE_DIR ZIP_FOUND)