aboutsummaryrefslogblamecommitdiffstats
path: root/testing/ebook-tools/10-cmake_libzip_zipconf_path.patch
blob: 71cc04baa596f2b5b55d77434db947cc4e7462a4 (plain) (tree)











































































                                                                                                                
Author: Pino Toscano <toscano.pino@tiscali.it>
Description: Get the include dir also for zipconf.h
 Since libzip 0.11.x, the architecture-specific zipconf.h has been moved to
 an include directory within the library path.
 Adapt the CMake stuff to search for zipconf.h there, making sure to use all
 the include directories needed when wanting to use libzip.
Forwarded: no
Last-Update: 2014-02-16
Bug-Debian: https://bugs.debian.org/739152

--- a/cmake/FindLibZip.cmake
+++ b/cmake/FindLibZip.cmake
@@ -2,7 +2,7 @@
 # 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) 2006, Pino Toscano, <toscano.pino@tiscali.it>
@@ -10,12 +10,12 @@
 # Redistribution and use is allowed according to the terms of the BSD license.
 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 
-if (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIR)
+if (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIRS)
   # in cache already
   set(LIBZIP_FOUND TRUE)
-else (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIR)
+else (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIRS)
 
-  find_path(LIBZIP_INCLUDE_DIR zip.h
+  find_path(_LIBZIP_INCLUDE_DIR zip.h
     ${GNUWIN32_DIR}/include
   )
 
@@ -24,13 +24,26 @@
     ${GNUWIN32_DIR}/lib
   )
 
+  if (LIBZIP_LIBRARY)
+    get_filename_component(_LIBZIP_LIBRARY_DIR ${LIBZIP_LIBRARY} PATH)
+
+    find_path(_ZIPCONF_INCLUDE_DIR zipconf.h
+      PATHS
+      ${_LIBZIP_LIBRARY_DIR}/include
+      ${_LIBZIP_LIBRARY_DIR}/libzip/include
+    )
+  endif()
+
   include(FindPackageHandleStandardArgs)
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibZip DEFAULT_MSG LIBZIP_LIBRARY LIBZIP_INCLUDE_DIR)
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibZip DEFAULT_MSG LIBZIP_LIBRARY _LIBZIP_INCLUDE_DIR _ZIPCONF_INCLUDE_DIR)
 
+  set(LIBZIP_INCLUDE_DIRS)
+  list(APPEND LIBZIP_INCLUDE_DIRS "${_LIBZIP_INCLUDE_DIR}")
+  list(APPEND LIBZIP_INCLUDE_DIRS "${_ZIPCONF_INCLUDE_DIR}")
     # ensure that they are cached
-    set(LIBZIP_INCLUDE_DIR ${LIBZIP_INCLUDE_DIR} CACHE INTERNAL "The libzip include path")
+    set(LIBZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIRS} CACHE INTERNAL "The libzip include paths")
     set(LIBZIP_LIBRARY ${LIBZIP_LIBRARY} CACHE INTERNAL "The libraries needed to use libzip")
 
-endif (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIR)
+endif (LIBZIP_LIBRARY AND LIBZIP_INCLUDE_DIRS)
 
-mark_as_advanced(LIBZIP_INCLUDE_DIR LIBZIP_LIBRARY)
+mark_as_advanced(LIBZIP_INCLUDE_DIRS LIBZIP_LIBRARY)
--- a/src/libepub/CMakeLists.txt
+++ b/src/libepub/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories (${EBOOK-TOOLS_SOURCE_DIR}/src/libepub ${LIBXML2_INCLUDE_DIR} ${LIBZIP_INCLUDE_DIR})
+include_directories (${EBOOK-TOOLS_SOURCE_DIR}/src/libepub ${LIBXML2_INCLUDE_DIR} ${LIBZIP_INCLUDE_DIRS})
 add_library (epub SHARED epub.c ocf.c opf.c linklist.c list.c)
 target_link_libraries (epub ${LIBZIP_LIBRARY} ${LIBXML2_LIBRARIES})