Skip to content
Permalink
Browse files

Add support for finding zipconf.h in separate location; use include dirs

LIBZIP_INCLUDE_DIRS could end up with duplicate entries, but seems to be
the simplest way of supporting headers installed to multiple locations.
  • Loading branch information
dakcarto committed Aug 15, 2017
1 parent 755980f commit 83aa1adf1eaf3c58b9c6c6bdc46d96d614362e21
Showing with 20 additions and 3 deletions.
  1. +19 −3 cmake/FindLibZip.cmake
  2. +1 −0 src/core/CMakeLists.txt
@@ -3,10 +3,12 @@
# Once done this will define
#
# LIBZIP_FOUND - system has the zip library
# LIBZIP_INCLUDE_DIR - the zip include directory
# LIBZIP_INCLUDE_DIRS - the zip include directories
# LIBZIP_LIBRARY - Link this to use the zip library
#
# Copyright (c) 2017, Paul Blottiere, <paul.blottiere@oslandia.com>
# Copyright (c) 2017, Larry Shaffer, <lshaffer (at) boundlessgeo (dot) com>
# Add support for finding zipconf.h in separate location, e.g. on macOS
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
@@ -20,6 +22,19 @@ FIND_PATH(LIBZIP_INCLUDE_DIR
"$ENV{INCLUDE}"
)

FIND_PATH(LIBZIP_CONF_INCLUDE_DIR
zipconf.h
PATHS
/usr/local/lib/libzip/include
/usr/lib/libzip/include
"$ENV{LIB_DIR}/lib/libzip/include"
"$ENV{LIB}/lib/libzip/include"
/usr/local/include
/usr/include
"$ENV{LIB_DIR}/include"
"$ENV{INCLUDE}"
)

FIND_LIBRARY(LIBZIP_LIBRARY
NAMES zip
PATHS
@@ -29,9 +44,10 @@ FIND_LIBRARY(LIBZIP_LIBRARY
"$ENV{LIB}"
)

IF (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIR)
IF (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIR AND LIBZIP_CONF_INCLUDE_DIR)
SET(LIBZIP_FOUND TRUE)
ENDIF (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIR)
SET(LIBZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIR} ${LIBZIP_CONF_INCLUDE_DIR})
ENDIF (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIR AND LIBZIP_CONF_INCLUDE_DIR)

IF (LIBZIP_FOUND)
MESSAGE(STATUS "Found libzip: ${LIBZIP_LIBRARY}")
@@ -1119,6 +1119,7 @@ INCLUDE_DIRECTORIES(
metadata
)
INCLUDE_DIRECTORIES(SYSTEM
${LIBZIP_INCLUDE_DIRS}
${SPATIALINDEX_INCLUDE_DIR}
${PROJ_INCLUDE_DIR}
${GEOS_INCLUDE_DIR}

0 comments on commit 83aa1ad

Please sign in to comment.
You can’t perform that action at this time.