1# Detect libzip, then use this priority list to determine
2# which library to use:
3#
4# Priority
5# 1. LIBZIP_INCLUDEPATH / LIBZIP_LIBPATH (qmake parameter, not checked it given on commandline)
6# 3. system's standard include paths from pkg-config
7
8exists($$LIBZIP_INCLUDEPATH/zip.h) {
9  ENABLE_LIBZIP=yes
10} else {
11  LIBZIP_INCLUDEPATH =
12  LIBZIP_LIBPATH =
13}
14
15isEmpty(LIBZIP_INCLUDEPATH) {
16  LIBZIP_CFLAGS = $$system("$$PKG_CONFIG --cflags libzip")
17  !isEmpty(LIBZIP_CFLAGS) {
18    ENABLE_LIBZIP=yes
19  }
20} else {
21  LIBZIP_CFLAGS = -I$$LIBZIP_INCLUDEPATH
22}
23
24isEmpty(LIBZIP_LIBPATH) {
25  LIBZIP_LIBS = $$system("$$PKG_CONFIG --libs libzip")
26  !isEmpty(LIBZIP_LIBS) {
27    ENABLE_LIBZIP=yes
28  }
29} else {
30  LIBZIP_LIBS = -L$$LIBZIP_LIBPATH -lzip
31}
32
33!isEmpty(ENABLE_LIBZIP) {
34  DEFINES += ENABLE_LIBZIP
35  QMAKE_CXXFLAGS += $$LIBZIP_CFLAGS
36  LIBS += $$LIBZIP_LIBS
37}
38