From a74fe93ffdb4f821cbf8189ba473d8df795f57a9 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Thu, 30 Sep 2010 15:55:13 +0200 Subject: RED-579: SNOW-751: 'configure' with cmake 2.8 is extremely slow. Note that indra/cmake/CMakeLists.txt is missing on imprudence, so I couldn't add 'FindZLIB.cmake' to the list of source files (see http://svn.secondlife.com/trac/linden/browser/projects/2009/snowglobe/trunk/indra/cmake/CMakeLists.txt) I added a comment to http://github.com/mccabe/imprudence/commit/39f625963e408ec5dd394e202506700259b9b508 that adds an empty indra/cmake/CMakeLists.txt If Jacek follows up and copies snowglobe's CMakeLists.txt then she'll have to remove the FindZLIB.cmake from it if she tests it before merging with THIS commit. In that case it has to be added back when merging that commit with this one. Tested on imprudence with cmake 2.8.2: * Without patch, 'configure' takes 100 seconds. * With patch, 'configure' takes 4 seconds. --- linden/indra/cmake/FindZLIB.cmake | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 linden/indra/cmake/FindZLIB.cmake (limited to 'linden/indra') diff --git a/linden/indra/cmake/FindZLIB.cmake b/linden/indra/cmake/FindZLIB.cmake new file mode 100644 index 0000000..6d630f1 --- /dev/null +++ b/linden/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 + ) + -- cgit v1.1