FindBZip2.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ################################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ################################################################################
  16. # - Try to find the BZIP2 compression library
  17. # Once done this will define
  18. #
  19. # BZIP2_FOUND - system has the BZIP2 library
  20. # BZIP2_INCLUDE_DIR - the BZIP include directory
  21. # BZIP2_LIBRARIES - The libraries needed to use BZIP2
  22. IF (NOT BZIP2_FOUND)
  23. IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
  24. IF(WIN32)
  25. SET (osdir "win32")
  26. SET (bzip2ver "1.0.6")
  27. SET (bzip2_lib "libbz2")
  28. ENDIF()
  29. IF (NOT ("${osdir}" STREQUAL "unknown"))
  30. FIND_PATH (BZIP2_INCLUDE_DIR NAMES bzlib.h PATHS "${EXTERNALS_DIRECTORY}/bzip2/${bzip2ver}/include"
  31. NO_DEFAULT_PATH)
  32. FIND_LIBRARY (BZIP2_LIBRARIES NAMES ${bzip2_lib} PATHS "${EXTERNALS_DIRECTORY}/bzip2/${bzip2ver}/lib/${osdir}" NO_DEFAULT_PATH)
  33. ENDIF()
  34. ENDIF()
  35. IF (USE_NATIVE_LIBRARIES)
  36. # if we didn't find in externals, look in system include path
  37. FIND_PATH (BZIP2_INCLUDE_DIR NAMES bzlib.h)
  38. FIND_LIBRARY (BZIP2_LIBRARIES NAMES ${bzip2_lib})
  39. ENDIF()
  40. include(FindPackageHandleStandardArgs)
  41. find_package_handle_standard_args(BZip2 DEFAULT_MSG
  42. BZIP2_LIBRARIES
  43. BZIP2_INCLUDE_DIR
  44. )
  45. MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)
  46. ENDIF()