FindBZip2.cmake 1.6 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. #=============================================================================
  10. # Copyright 2006-2009 Kitware, Inc.
  11. # Copyright 2006 Alexander Neundorf <[email protected]>
  12. #
  13. # Distributed under the OSI-approved BSD License (the "License");
  14. # see accompanying file Copyright.txt for details.
  15. #
  16. # This software is distributed WITHOUT ANY WARRANTY; without even the
  17. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. # See the License for more information.
  19. #=============================================================================
  20. # (To distributed this file outside of CMake, substitute the full
  21. # License text for the above reference.)
  22. IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
  23. SET(BZip2_FIND_QUIETLY TRUE)
  24. ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
  25. FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h )
  26. FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 )
  27. # handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if
  28. # all listed variables are TRUE
  29. INCLUDE(FindPackageHandleStandardArgs)
  30. FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 DEFAULT_MSG BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
  31. IF (BZIP2_FOUND)
  32. INCLUDE(CheckLibraryExists)
  33. CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
  34. ENDIF (BZIP2_FOUND)
  35. MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)