Description: Linking against system-wide libminizip
Author: Sebastien Jodogne <s.jodogne@orthanc-labs.com>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: Orthanc-1.12.10/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake
===================================================================
--- Orthanc-1.12.10.orig/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake
+++ Orthanc-1.12.10/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake
@@ -754,10 +754,22 @@ set(ORTHANC_CORE_SOURCES_DEPENDENCIES
 if (ENABLE_ZLIB AND NOT ORTHANC_SANDBOXED)
   list(APPEND ORTHANC_CORE_SOURCES_DEPENDENCIES
     # This is the minizip distribution to create/decode ZIP files using zlib
-    ${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/minizip/ioapi.c
-    ${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/minizip/unzip.c
-    ${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/minizip/zip.c
+    # ${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/minizip/ioapi.c
+    # ${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/minizip/unzip.c
+    # ${CMAKE_CURRENT_LIST_DIR}/../../Resources/ThirdParty/minizip/zip.c
     )
+
+  CHECK_INCLUDE_FILE_CXX(minizip/zip.h HAVE_MINIZIP_H)
+  if (NOT HAVE_MINIZIP_H)
+    message(FATAL_ERROR "Please install the libminizip-dev package")
+  endif()
+
+  CHECK_LIBRARY_EXISTS(minizip "zipOpen2_64" "" HAVE_MINIZIP_LIB)
+  if (NOT HAVE_MINIZIP_LIB)
+    message(FATAL_ERROR "Please install the libminizip-dev package")
+  endif()
+
+  link_libraries(minizip)
 endif()
 
 
Index: Orthanc-1.12.10/OrthancFramework/Sources/Compression/ZipReader.cpp
===================================================================
--- Orthanc-1.12.10.orig/OrthancFramework/Sources/Compression/ZipReader.cpp
+++ Orthanc-1.12.10/OrthancFramework/Sources/Compression/ZipReader.cpp
@@ -31,7 +31,7 @@
 #include "ZipReader.h"
 
 #include "../OrthancException.h"
-#include "../../Resources/ThirdParty/minizip/unzip.h"
+#include <minizip/unzip.h>
 
 #if ORTHANC_SANDBOXED != 1
 #  include "../SystemToolbox.h"
Index: Orthanc-1.12.10/OrthancFramework/Sources/Compression/ZipWriter.cpp
===================================================================
--- Orthanc-1.12.10.orig/OrthancFramework/Sources/Compression/ZipWriter.cpp
+++ Orthanc-1.12.10/OrthancFramework/Sources/Compression/ZipWriter.cpp
@@ -34,7 +34,7 @@
 #include <boost/filesystem.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 
-#include "../../Resources/ThirdParty/minizip/zip.h"
+#include <minizip/zip.h>
 #include "../Logging.h"
 #include "../OrthancException.h"
 #include "../SystemToolbox.h"
