1#=============================================================================
2# Find WebP library
3#=============================================================================
4# Find the native WebP headers and libraries.
5#
6#  WEBP_INCLUDE_DIRS - where to find webp/decode.h, etc.
7#  WEBP_LIBRARIES    - List of libraries when using webp.
8#  WEBP_FOUND        - True if webp is found.
9#=============================================================================
10
11# Look for the header file.
12
13unset(WEBP_FOUND)
14
15FIND_PATH(WEBP_INCLUDE_DIR NAMES webp/decode.h)
16
17if(NOT WEBP_INCLUDE_DIR)
18    unset(WEBP_FOUND)
19else()
20    MARK_AS_ADVANCED(WEBP_INCLUDE_DIR)
21
22    # Look for the library.
23    FIND_LIBRARY(WEBP_LIBRARY NAMES webp)
24    MARK_AS_ADVANCED(WEBP_LIBRARY)
25
26    # handle the QUIETLY and REQUIRED arguments and set WEBFOUND_FOUND to TRUE if
27    # all listed variables are TRUE
28    INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
29    FIND_PACKAGE_HANDLE_STANDARD_ARGS(WebP DEFAULT_MSG WEBP_LIBRARY WEBP_INCLUDE_DIR)
30
31    SET(WEBP_LIBRARIES ${WEBP_LIBRARY})
32    SET(WEBP_INCLUDE_DIRS ${WEBP_INCLUDE_DIR})
33endif()
34