FindMinizip.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #.rst:
  2. # FindMINIZIP
  3. # --------
  4. #
  5. # Locate Minizip library
  6. #
  7. # This module defines
  8. #
  9. # ::
  10. #
  11. # MINIZIP_LIBRARY, the name of the library to link against
  12. # MINIZIP_FOUND, if false, do not try to link to Minizip
  13. # MINIZIP_INCLUDE_DIR, where to find unzip.h
  14. # MINIZIP_VERSION_STRING, human-readable string containing the version of Minizip
  15. #
  16. #=============================================================================
  17. # Copyright 2003-2009 Kitware, Inc.
  18. # Copyright 2012 Benjamin Eikel
  19. #
  20. # Distributed under the OSI-approved BSD License (the "License");
  21. # see accompanying file kitware license.txt for details.
  22. #
  23. # This software is distributed WITHOUT ANY WARRANTY; without even the
  24. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  25. # See the License for more information.
  26. #=============================================================================
  27. # (To distribute this file outside of CMake, substitute the full
  28. # License text for the above reference.)
  29. if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  30. set(VC_LIB_PATH_SUFFIX lib/x64)
  31. else()
  32. set(VC_LIB_PATH_SUFFIX lib/x86)
  33. endif()
  34. if (NOT WIN32)
  35. find_package(PkgConfig)
  36. if (PKG_CONFIG_FOUND)
  37. pkg_check_modules(_MINIZIP minizip)
  38. set(MINIZIP_VERSION_STRING ${_MINIZIP_VERSION})
  39. endif ()
  40. endif ()
  41. find_path(MINIZIP_INCLUDE_DIR
  42. minizip/unzip.h
  43. HINTS
  44. ${_MINIZIP_INCLUDEDIR}
  45. ENV MINIZIPDIR
  46. PATH_SUFFIXES
  47. MINIZIP
  48. include
  49. )
  50. find_library(MINIZIP_LIBRARY
  51. NAMES
  52. minizip
  53. HINTS
  54. ${_MINIZIP_LIBDIR}
  55. ENV MINIZIPDIR
  56. PATH_SUFFIXES
  57. lib
  58. ${VC_LIB_PATH_SUFFIX}
  59. )
  60. set(MINIZIP_LIBRARIES ${MINIZIP_LIBRARY})
  61. set(MINIZIP_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIR})
  62. include(FindPackageHandleStandardArgs)
  63. FIND_PACKAGE_HANDLE_STANDARD_ARGS(MINIZIP
  64. REQUIRED_VARS MINIZIP_LIBRARY MINIZIP_INCLUDE_DIR
  65. VERSION_VAR MINIZIP_VERSION_STRING)