diff options
Diffstat (limited to 'project/cmake/modules/FindZip.cmake')
| -rw-r--r-- | project/cmake/modules/FindZip.cmake | 46 |
1 files changed, 46 insertions, 0 deletions
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 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindZip | ||
| 3 | # ----------- | ||
| 4 | # Finds the Zip library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # ZIP_FOUND - system has Zip | ||
| 9 | # ZIP_INCLUDE_DIRS - the Zip include directory | ||
| 10 | # ZIP_LIBRARIES - the Zip libraries | ||
| 11 | # ZIP_DEFINITIONS - the Zip libraries | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # ZIP::ZIP - The Zip library | ||
| 16 | |||
| 17 | if(PKG_CONFIG_FOUND) | ||
| 18 | pkg_check_modules(PC_ZIP libzip QUIET) | ||
| 19 | endif() | ||
| 20 | |||
| 21 | find_path(ZIP_INCLUDE_DIR zip.h | ||
| 22 | PATHS ${PC_ZIP_INCLUDEDIR}) | ||
| 23 | find_library(ZIP_LIBRARY NAMES zip | ||
| 24 | PATHS ${PC_ZIP_LIBDIR}) | ||
| 25 | set(ZIP_VERSION ${PC_ZIP_VERSION}) | ||
| 26 | |||
| 27 | include(FindPackageHandleStandardArgs) | ||
| 28 | find_package_handle_standard_args(ZIP | ||
| 29 | REQUIRED_VARS ZIP_LIBRARY ZIP_INCLUDE_DIR | ||
| 30 | VERSION_VAR ZIP_VERSION) | ||
| 31 | |||
| 32 | if(ZIP_FOUND) | ||
| 33 | set(ZIP_LIBRARIES ${ZIP_LIBRARY}) | ||
| 34 | set(ZIP_INCLUDE_DIRS ${ZIP_INCLUDE_DIR}) | ||
| 35 | set(ZIP_DEFINITIONS "${PC_ZIP_CFLAGS}") | ||
| 36 | |||
| 37 | if(NOT TARGET ZIP::ZIP) | ||
| 38 | add_library(ZIP::ZIP UNKNOWN IMPORTED) | ||
| 39 | set_target_properties(ZIP::ZIP PROPERTIES | ||
| 40 | IMPORTED_LOCATION "${ZIP_LIBRARY}" | ||
| 41 | INTERFACE_INCLUDE_DIRECTORIES "${ZIP_INCLUDE_DIR}" | ||
| 42 | INTERFACE_COMPILE_DEFINITIONS "${PC_ZIP_CFLAGS}") | ||
| 43 | endif() | ||
| 44 | endif() | ||
| 45 | |||
| 46 | mark_as_advanced(ZIP_INCLUDE_DIR ZIP_LIBRARY) | ||
