Cdroid/cmake/modules/FindZIP.cmake
2023-09-06 18:29:48 +08:00

30 lines
827 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(ZIP 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)