From 9a75f145de53a04eca02dd5da5c2ab092f67d2f0 Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 20 Apr 2006 12:25:46 +0000 Subject: OK so FIND_PATH and FIND_LIBRARIES use the cache already, so no need for the CACHED_FOO fast-path when the check only uses those. Instead I used this, to avoid "Found libfoo" in the output when in fact we didn't just look for it, we had it in the cache. +if (TIFF_INCLUDE_DIR) + # Already in cache, be silent + set(TIFF_FIND_QUIETLY TRUE) +endif (TIFF_INCLUDE_DIR) CACHED_FOO remains for the cases where there is more logic to the configure check, like PKGCONFIG, foo-config, or CHECK_LIBRARY_EXISTS (e.g. bzip2) CCMAIL: kde-buildsystem@kde.org svn path=/trunk/KDE/kdelibs/; revision=531839 --- modules/FindZLIB.cmake | 72 ++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 41 deletions(-) (limited to 'modules/FindZLIB.cmake') diff --git a/modules/FindZLIB.cmake b/modules/FindZLIB.cmake index ecbca6fc..2fcfdd15 100644 --- a/modules/FindZLIB.cmake +++ b/modules/FindZLIB.cmake @@ -1,41 +1,31 @@ -IF (DEFINED CACHED_ZLIB) - - # in cache already - IF ("${CACHED_ZLIB}" STREQUAL "YES") - SET(ZLIB_FOUND TRUE) - ENDIF ("${CACHED_ZLIB}" STREQUAL "YES") - -ELSE (DEFINED CACHED_ZLIB) - - FIND_PATH(ZLIB_INCLUDE_DIR zlib.h - /usr/include - /usr/local/include - ) - - FIND_LIBRARY(ZLIB_LIBRARY NAMES z zlib - PATHS - /usr/lib - /usr/local/lib - ) - - IF (ZLIB_INCLUDE_DIR) - SET(ZLIB_FOUND TRUE) - SET(CACHED_ZLIB "YES") - ELSE (ZLIB_INCLUDE_DIR) - SET(CACHED_ZLIB "NO") - ENDIF (ZLIB_INCLUDE_DIR) - - IF (ZLIB_FOUND) - IF (NOT ZLIB_FIND_QUIETLY) - MESSAGE(STATUS "Found Z: ${ZLIB_LIBRARY}") - ENDIF (NOT ZLIB_FIND_QUIETLY) - ELSE (ZLIB_FOUND) - IF (ZLIB_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find z library") - ENDIF (ZLIB_FIND_REQUIRED) - ENDIF (ZLIB_FOUND) - - SET(CACHED_ZLIB ${CACHED_ZLIB} CACHE INTERNAL "If zlib was checked") - MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) - -ENDIF (DEFINED CACHED_ZLIB) +if (ZLIB_INCLUDE_DIR) + # Already in cache, be silent + set(ZLIB_FIND_QUIETLY TRUE) +endif (ZLIB_INCLUDE_DIR) + +FIND_PATH(ZLIB_INCLUDE_DIR zlib.h + /usr/include + /usr/local/include +) + +FIND_LIBRARY(ZLIB_LIBRARY NAMES z zlib +PATHS + /usr/lib + /usr/local/lib +) + +IF (ZLIB_INCLUDE_DIR) + SET(ZLIB_FOUND TRUE) +ENDIF (ZLIB_INCLUDE_DIR) + +IF (ZLIB_FOUND) + IF (NOT ZLIB_FIND_QUIETLY) + MESSAGE(STATUS "Found Z: ${ZLIB_LIBRARY}") + ENDIF (NOT ZLIB_FIND_QUIETLY) +ELSE (ZLIB_FOUND) + IF (ZLIB_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find z library") + ENDIF (ZLIB_FIND_REQUIRED) +ENDIF (ZLIB_FOUND) + +MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -- cgit v1.2.1