comparison cmake/FindLibzip.cmake @ 335:68287c7bcdb5

core: implement vfs-zip (read-only)
author David Demelier <markand@malikania.fr>
date Wed, 13 Oct 2021 15:58:02 +0200
parents
children
comparison
equal deleted inserted replaced
334:1d3e6108cb99 335:68287c7bcdb5
1 # FindLibzip
2 # -----------
3 #
4 # Find Libzip library, this modules defines:
5 #
6 # Libzip_INCLUDE_DIRS, where to find libzip.h
7 # Libzip_LIBRARIES, where to find library
8 # Libzip_FOUND, if it is found
9 #
10 # The following imported targets will be available:
11 #
12 # Libzip::Libzip, if found.
13 #
14
15 find_path(Libzip_INCLUDE_DIR NAMES zip.h)
16 find_library(Libzip_LIBRARY NAMES libzip zip)
17
18 include(FindPackageHandleStandardArgs)
19
20 find_package_handle_standard_args(
21 Libzip
22 FOUND_VAR Libzip_FOUND
23 REQUIRED_VARS Libzip_LIBRARY Libzip_INCLUDE_DIR
24 )
25
26 if (Libzip_FOUND)
27 set(Libzip_LIBRARIES ${Libzip_LIBRARY})
28 set(Libzip_INCLUDE_DIRS ${Libzip_INCLUDE_DIR})
29
30 if (NOT TARGET Libzip::Libzip)
31 add_library(Libzip::Libzip UNKNOWN IMPORTED)
32 set_target_properties(
33 Libzip::Libzip
34 PROPERTIES
35 IMPORTED_LINK_INTERFACE_LANGUAGES "C"
36 IMPORTED_LOCATION "${Libzip_LIBRARY}"
37 INTERFACE_INCLUDE_DIRECTORIES "${Libzip_INCLUDE_DIRS}"
38 )
39 endif ()
40 endif ()
41
42 mark_as_advanced(Libzip_INCLUDE_DIR Libzip_LIBRARY)