Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Modules / FindBZip2.cmake
blob5842038449fdaab8c9e6996190bf86e0c6dca804
1 # - Try to find BZip2
2 # Once done this will define
4 #  BZIP2_FOUND - system has BZip2
5 #  BZIP2_INCLUDE_DIR - the BZip2 include directory
6 #  BZIP2_LIBRARIES - Link these to use BZip2
7 #  BZIP2_DEFINITIONS - Compiler switches required for using BZip2
8 #  BZIP2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_
10 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
12 # Redistribution and use is allowed according to the terms of the BSD license.
13 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
16 IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
17     SET(BZip2_FIND_QUIETLY TRUE)
18 ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
20 FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h )
22 FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 )
24 # handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if 
25 # all listed variables are TRUE
26 INCLUDE(FindPackageHandleStandardArgs)
27 FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 DEFAULT_MSG BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
29 IF (BZIP2_FOUND)
30    INCLUDE(CheckLibraryExists)
31    CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
32 ENDIF (BZIP2_FOUND)
34 MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)