From d6a49b935764599ca07073f702e9c0bbff6b6b71 Mon Sep 17 00:00:00 2001
From: Utkarsh Ayachit <utkarsh.ayachit@kitware.com>
Date: Thu, 2 May 2013 16:42:13 -0400
Subject: [PATCH] Fixing zlib dependency for libxml2.

vtklibxml2 depends on zlib but was never setting up a dependency for it nor was
it using the right variable after modularization changes. Fixed that.

Change-Id: I5932313ea5b2cdba47e885a728778abc5d6739f8
---
 ThirdParty/libxml2/module.cmake              |  5 ++++-
 ThirdParty/libxml2/vtklibxml2/CMakeLists.txt | 16 ++++++++--------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/ThirdParty/libxml2/module.cmake b/ThirdParty/libxml2/module.cmake
index 2bbe4d26c56..f96c43001c8 100644
--- a/ThirdParty/libxml2/module.cmake
+++ b/ThirdParty/libxml2/module.cmake
@@ -1 +1,4 @@
-vtk_module(vtklibxml2 EXCLUDE_FROM_WRAPPING)
+vtk_module(vtklibxml2
+  DEPENDS
+    vtkzlib
+  EXCLUDE_FROM_WRAPPING)
diff --git a/ThirdParty/libxml2/vtklibxml2/CMakeLists.txt b/ThirdParty/libxml2/vtklibxml2/CMakeLists.txt
index 75f7b768985..5bd006bafaf 100644
--- a/ThirdParty/libxml2/vtklibxml2/CMakeLists.txt
+++ b/ThirdParty/libxml2/vtklibxml2/CMakeLists.txt
@@ -45,9 +45,9 @@ CHECK_LIBRARY_EXISTS_CONCAT("dld"      shl_load       HAVE_SHLLOAD)
 
 #CHECK_LIBRARY_EXISTS_CONCAT("history"  append_history HAVE_LIBHISTORY)
 #CHECK_LIBRARY_EXISTS_CONCAT("readline" readline       HAVE_LIBREADLINE)
-IF(NOT VTK_ZLIB_LIBRARIES)
+IF(NOT vtkzlib_LIBRARIES)
   CHECK_LIBRARY_EXISTS_CONCAT("z"      inflateEnd     HAVE_LIBZ)
-ENDIF(NOT VTK_ZLIB_LIBRARIES)
+ENDIF(NOT vtkzlib_LIBRARIES)
 
 # Use needed system libraries.
 SET(LIBXML2_LIBS ${LIBXML2_LIBS} ${CMAKE_THREAD_LIBS} ${CMAKE_DL_LIBS})
@@ -63,10 +63,10 @@ SET(CMAKE_REQUIRED_LIBRARIES ${LIBXML2_LIBS})
 SET(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
 
 # Use VTK's zlib if we are building in the tree.
-IF(VTK_ZLIB_LIBRARIES)
+IF(vtkzlib_LIBRARIES)
   SET(HAVE_LIBZ 1)
-  SET(LIBXML2_LIBS ${VTK_ZLIB_LIBRARIES} ${LIBXML2_LIBS})
-ENDIF(VTK_ZLIB_LIBRARIES)
+  SET(LIBXML2_LIBS ${vtkzlib_LIBRARIES} ${LIBXML2_LIBS})
+ENDIF(vtkzlib_LIBRARIES)
 
 # Check if header file exists and add it to the list.
 MACRO(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
@@ -151,12 +151,12 @@ LIBXML2_PLATFORM_C_TEST(HAVE___VA_COPY   "Checking for __va_copy" DIRECT)
 LIBXML2_PLATFORM_C_TEST(SUPPORT_IP6      "Checking for ipv6 support." DIRECT)
 
 # Use VTK's zlib if we are building in the tree.
-IF(VTK_ZLIB_LIBRARIES)
+IF(vtkzlib_LIBRARIES)
   SET(HAVE_VTK_ZLIB_H 1)
   SET(HAVE_ZLIB_H 1)
-ELSE(VTK_ZLIB_LIBRARIES)
+ELSE(vtkzlib_LIBRARIES)
   CHECK_INCLUDE_FILE_CONCAT("zlib.h"           HAVE_ZLIB_H)
-ENDIF(VTK_ZLIB_LIBRARIES)
+ENDIF(vtkzlib_LIBRARIES)
 
 IF(HAVE_SOCKLEN_T)
   SET(XML_SOCKLEN_T "socklen_t")
-- 
GitLab