From 9fc8b732737f139d3e466510d75668ab45578960 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 8 Mar 2016 21:02:53 +0100 Subject: sync with upstream --- project/cmake/modules/FindZip.cmake | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 project/cmake/modules/FindZip.cmake (limited to 'project/cmake/modules/FindZip.cmake') diff --git a/project/cmake/modules/FindZip.cmake b/project/cmake/modules/FindZip.cmake new file mode 100644 index 0000000..e0a38c1 --- /dev/null +++ b/project/cmake/modules/FindZip.cmake @@ -0,0 +1,46 @@ +#.rst: +# FindZip +# ----------- +# Finds the Zip library +# +# This will will define the following variables:: +# +# ZIP_FOUND - system has Zip +# ZIP_INCLUDE_DIRS - the Zip include directory +# ZIP_LIBRARIES - the Zip libraries +# ZIP_DEFINITIONS - the Zip libraries +# +# and the following imported targets:: +# +# ZIP::ZIP - The Zip library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_ZIP libzip QUIET) +endif() + +find_path(ZIP_INCLUDE_DIR zip.h + PATHS ${PC_ZIP_INCLUDEDIR}) +find_library(ZIP_LIBRARY NAMES zip + PATHS ${PC_ZIP_LIBDIR}) +set(ZIP_VERSION ${PC_ZIP_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ZIP + REQUIRED_VARS ZIP_LIBRARY ZIP_INCLUDE_DIR + VERSION_VAR ZIP_VERSION) + +if(ZIP_FOUND) + set(ZIP_LIBRARIES ${ZIP_LIBRARY}) + set(ZIP_INCLUDE_DIRS ${ZIP_INCLUDE_DIR}) + set(ZIP_DEFINITIONS "${PC_ZIP_CFLAGS}") + + if(NOT TARGET ZIP::ZIP) + add_library(ZIP::ZIP UNKNOWN IMPORTED) + set_target_properties(ZIP::ZIP PROPERTIES + IMPORTED_LOCATION "${ZIP_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${ZIP_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS "${PC_ZIP_CFLAGS}") + endif() +endif() + +mark_as_advanced(ZIP_INCLUDE_DIR ZIP_LIBRARY) -- cgit v1.2.3