FindBZip2.cmake 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # - Try to find BZip2
  2. # Once done this will define
  3. #
  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_
  9. # Copyright (c) 2006, Alexander Neundorf, <[email protected]>
  10. #
  11. # Redistribution and use is allowed according to the terms of the BSD license.
  12. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  13. IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
  14. SET(BZip2_FIND_QUIETLY TRUE)
  15. ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
  16. FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h )
  17. FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 )
  18. IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
  19. SET(BZIP2_FOUND TRUE)
  20. INCLUDE(CheckLibraryExists)
  21. CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
  22. ELSE (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
  23. SET(BZIP2_FOUND FALSE)
  24. ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
  25. IF (BZIP2_FOUND)
  26. IF (NOT BZip2_FIND_QUIETLY)
  27. MESSAGE(STATUS "Found BZip2: ${BZIP2_LIBRARIES}")
  28. ENDIF (NOT BZip2_FIND_QUIETLY)
  29. ELSE (BZIP2_FOUND)
  30. IF (BZip2_FIND_REQUIRED)
  31. MESSAGE(FATAL_ERROR "Could NOT find BZip2")
  32. ENDIF (BZip2_FIND_REQUIRED)
  33. ENDIF (BZIP2_FOUND)
  34. MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)