Mercurial > code
comparison cmake/FindZIP.cmake @ 624:01e01777ff50
CMake: initial import of CMake modules, closes #720
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 20 Oct 2017 14:18:37 +0200 |
parents | |
children | 5bd9424a523a |
comparison
equal
deleted
inserted
replaced
623:2081e695bfbd | 624:01e01777ff50 |
---|---|
1 # FindZIP | |
2 # ------- | |
3 # | |
4 # Find libzip library, this modules defines: | |
5 # | |
6 # ZIP_INCLUDE_DIRS, where to find zip.h | |
7 # ZIP_LIBRARIES, where to find library | |
8 # ZIP_FOUND, if it is found | |
9 | |
10 find_package(ZLIB QUIET) | |
11 | |
12 find_path( | |
13 ZIP_INCLUDE_DIR | |
14 NAMES zip.h | |
15 ) | |
16 | |
17 find_library( | |
18 ZIP_LIBRARY | |
19 NAMES zip libzip | |
20 ) | |
21 | |
22 find_path( | |
23 ZIPCONF_INCLUDE_DIR | |
24 NAMES zipconf.h | |
25 ) | |
26 | |
27 if (NOT ZIPCONF_INCLUDE_DIR) | |
28 # zipconf.h is sometimes directly in the include/ folder but on some systems | |
29 # like Windows, it is installed in the lib/ directory. | |
30 get_filename_component(_ZIP_PRIVATE_LIBRARY "${ZIP_LIBRARY}" DIRECTORY) | |
31 | |
32 find_path( | |
33 ZIPCONF_INCLUDE_DIR | |
34 NAMES zipconf.h | |
35 PATHS "${_ZIP_PRIVATE_LIBRARY}/libzip/include" | |
36 ) | |
37 endif () | |
38 | |
39 include(FindPackageHandleStandardArgs) | |
40 | |
41 find_package_handle_standard_args( | |
42 ZIP | |
43 REQUIRED_VARS ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS ZIP_LIBRARY ZIP_INCLUDE_DIR ZIPCONF_INCLUDE_DIR | |
44 ) | |
45 | |
46 if (ZIP_FOUND) | |
47 set(ZIP_LIBRARIES ${ZIP_LIBRARY} ${ZLIB_LIBRARIES}) | |
48 set(ZIP_INCLUDE_DIRS ${ZIP_INCLUDE_DIR} ${ZIPCONF_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS}) | |
49 endif () | |
50 | |
51 mark_as_advanced(ZIP_LIBRARY ZIP_INCLUDE_DIR ZIPCONF_INCLUDE_DIR) |