FindBZip2.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. IF (${ARCH64BIT} EQUAL 1)
  26. SET (osdir "win64")
  27. ELSE()
  28. SET (osdir "win32")
  29. ENDIF()
  30. SET (bzip2ver "1.0.6")
  31. SET (bzip2_lib "libbz2")
  32. ENDIF()
  33. IF (NOT ("${osdir}" STREQUAL "unknown"))
  34. FIND_PATH (BZIP2_INCLUDE_DIR NAMES bzlib.h PATHS "${EXTERNALS_DIRECTORY}/bzip2/${bzip2ver}/include"
  35. NO_DEFAULT_PATH)
  36. FIND_LIBRARY (BZIP2_LIBRARIES NAMES ${bzip2_lib} PATHS "${EXTERNALS_DIRECTORY}/bzip2/${bzip2ver}/lib/${osdir}" NO_DEFAULT_PATH)
  37. ENDIF()
  38. ENDIF()
  39. IF (USE_NATIVE_LIBRARIES)
  40. # if we didn't find in externals, look in system include path
  41. FIND_PATH (BZIP2_INCLUDE_DIR NAMES bzlib.h)
  42. FIND_LIBRARY (BZIP2_LIBRARIES NAMES ${bzip2_lib})
  43. ENDIF()
  44. include(FindPackageHandleStandardArgs)
  45. find_package_handle_standard_args(BZip2 DEFAULT_MSG
  46. BZIP2_LIBRARIES
  47. BZIP2_INCLUDE_DIR
  48. )
  49. MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)
  50. ENDIF()