decrypt drsuapi attributes
[wireshark-sm.git] / cmake / modules / FindILBC.cmake
blob6dc81a49f2a6ce94ef11511ace20525776db4910
1 # Find the system's ilbc includes and library
3 #  ILBC_INCLUDE_DIRS - where to find ilbc.h
4 #  ILBC_LIBRARIES    - List of libraries when using ilbc
5 #  ILBC_FOUND        - True if ilbc found
6 #  ILBC_DLL_DIR      - (Windows) Path to the ilbc DLL
7 #  ILBC_DLL          - (Windows) Name of the ilbc DLL
9 include( FindWSWinLibs )
10 FindWSWinLibs( "libilbc-.*" "ILBC_HINTS" )
12 if (NOT USE_REPOSITORY)
13   find_package(PkgConfig)
14   pkg_search_module(PC_ILBC libilbc)
15 endif()
17 find_path(ILBC_INCLUDE_DIR
18   NAMES ilbc.h
19   HINTS
20     "${PC_ILBC_INCLUDE_DIRS}"
21     "${ILBC_HINTS}/include"
22   PATHS /usr/local/include /usr/include
25 find_library(ILBC_LIBRARY
26   NAMES
27     ilbc
28     libilbc-2
29   HINTS
30     "${PC_ILBC_LIBRARY_DIRS}"
31     "${ILBC_HINTS}/lib"
32   PATHS /usr/local/lib /usr/lib
35 # Check if ilbc library is WebRTC from https://github.com/TimothyGu/libilbc
36 if(ILBC_INCLUDE_DIR AND ILBC_LIBRARY)
37   include(CheckSymbolExists)
38   cmake_push_check_state()
39   set(CMAKE_REQUIRED_INCLUDES ${ILBC_INCLUDE_DIR})
40   set(CMAKE_REQUIRED_LIBRARIES ${ILBC_LIBRARY})
41   check_symbol_exists("WebRtcIlbcfix_DecoderCreate" "ilbc.h" HAVE_ILBC_LIB_WEBRTC)
42   cmake_pop_check_state()
44   if(NOT HAVE_ILBC_LIB_WEBRTC)
45     message(STATUS "Ignoring incompatible iLBC library.")
46     # Unset the variables so the search will rerun next time
47     set(ILBC_INCLUDE_DIR "ILBC_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
48     set(ILBC_LIBRARY "ILBC_LIBRARY-NOTFOUND" CACHE FILEPATH "" FORCE)
49     unset(HAVE_ILBC_LIB_WEBRTC CACHE)
50   endif()
51 endif()
53 include(FindPackageHandleStandardArgs)
54 find_package_handle_standard_args(ILBC DEFAULT_MSG ILBC_LIBRARY ILBC_INCLUDE_DIR)
56 if( ILBC_FOUND )
57   set( ILBC_INCLUDE_DIRS ${ILBC_INCLUDE_DIR} )
58   set( ILBC_LIBRARIES ${ILBC_LIBRARY} )
59   if (WIN32)
60     set ( ILBC_DLL_DIR "${ILBC_HINTS}/bin"
61       CACHE PATH "Path to ilbc DLL"
62     )
63     file( GLOB _ilbc_dll RELATIVE "${ILBC_DLL_DIR}"
64       "${ILBC_DLL_DIR}/libilbc-*.dll"
65     )
66     set ( ILBC_DLL ${_ilbc_dll}
67       # We're storing filenames only. Should we use STRING instead?
68       CACHE FILEPATH "ilbc DLL file name"
69     )
70     mark_as_advanced( ILBC_DLL_DIR ILBC_DLL )
71   endif()
72 else()
73   set( ILBC_INCLUDE_DIRS )
74   set( ILBC_LIBRARIES )
75 endif()
77 mark_as_advanced( ILBC_LIBRARIES ILBC_INCLUDE_DIRS )