From 3f5d67bcb751858c20121e1f85a63a447ed13903 Mon Sep 17 00:00:00 2001
From: Aleric Inglewood <Aleric.Inglewood@gmail.com>
Date: Mon, 20 Dec 2010 16:10:07 +0100
Subject: [PATCH] VWR-24261: Configuration with cmake 2.8 is extremely slow

Add non-broken FindZLIB.cmake.
---
 doc/contributions.txt      |  1 +
 indra/cmake/CMakeLists.txt |  1 +
 indra/cmake/FindZLIB.cmake | 46 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)
 create mode 100644 indra/cmake/FindZLIB.cmake

diff --git a/doc/contributions.txt b/doc/contributions.txt
index f33af2599dd..d4252f9ff51 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -77,6 +77,7 @@ Aleric Inglewood
 	VWR-24247
 	VWR-24251
 	VWR-24252
+	VWR-24261
 	SNOW-84
 	SNOW-477
 	SNOW-744
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index 64708362861..3f421b270b9 100644
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -33,6 +33,7 @@ set(cmake_SOURCE_FILES
     FindMySQL.cmake
     FindOpenJPEG.cmake
     FindXmlRpcEpi.cmake
+    FindZLIB.cmake
     FMOD.cmake
     FreeType.cmake
     GStreamer010Plugin.cmake
diff --git a/indra/cmake/FindZLIB.cmake b/indra/cmake/FindZLIB.cmake
new file mode 100644
index 00000000000..6d630f1ba96
--- /dev/null
+++ b/indra/cmake/FindZLIB.cmake
@@ -0,0 +1,46 @@
+# -*- cmake -*-
+
+# - Find zlib
+# Find the ZLIB includes and library
+# This module defines
+#  ZLIB_INCLUDE_DIRS, where to find zlib.h, etc.
+#  ZLIB_LIBRARIES, the libraries needed to use zlib.
+#  ZLIB_FOUND, If false, do not try to use zlib.
+#
+# This FindZLIB is about 43 times as fast the one provided with cmake (2.8.x),
+# because it doesn't look up the version of zlib, resulting in a dramatic
+# speed up for configure (from 4 minutes 22 seconds to 6 seconds).
+#
+# Note: Since this file is only used for standalone, the windows
+# specific parts were left out.
+
+FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
+  NO_SYSTEM_ENVIRONMENT_PATH
+  )
+
+FIND_LIBRARY(ZLIB_LIBRARY z)
+
+if (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
+  SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
+  SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+  SET(ZLIB_FOUND "YES")
+else (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
+  SET(ZLIB_FOUND "NO")
+endif (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
+
+if (ZLIB_FOUND)
+  if (NOT ZLIB_FIND_QUIETLY)
+	message(STATUS "Found ZLIB: ${ZLIB_LIBRARIES}")
+	SET(ZLIB_FIND_QUIETLY TRUE)
+  endif (NOT ZLIB_FIND_QUIETLY)
+else (ZLIB_FOUND)
+  if (ZLIB_FIND_REQUIRED)
+	message(FATAL_ERROR "Could not find ZLIB library")
+  endif (ZLIB_FIND_REQUIRED)
+endif (ZLIB_FOUND)
+
+mark_as_advanced(
+  ZLIB_LIBRARY
+  ZLIB_INCLUDE_DIR
+  )
+
-- 
GitLab