Subject: Use packaged libwebm
Author: Vasyl Gello <vasek.gello@gmail.com>
Forwarded: not-needed

---

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,7 +56,6 @@
 include_directories(${INCLUDES}
                     ${KODI_INCLUDE_DIR}/.. # Hack way with "/..", need bigger Kodi cmake rework to match right include ways (becomes done in future)
                     lib/libbento4/Core
-                    lib/webm_parser/include
 )
 
 set(CMAKE_FIND_FRAMEWORK LAST)
@@ -66,6 +65,11 @@
 include_directories(${EXPAT_INCLUDE_DIRS})
 list(APPEND DEPLIBS ${EXPAT_LIBRARIES})
 
+include(FindWEBM)
+find_package(WEBM REQUIRED)
+include_directories(${WEBM_INCLUDE_DIRS})
+list(APPEND DEPLIBS ${WEBM_LIBRARIES})
+
 if(WIN32)
   add_definitions(-DXML_STATIC -D_CRT_NONSTDC_NO_DEPRECATE)
   list(APPEND DEPLIBS ws2_32)
@@ -77,8 +81,6 @@
 
 add_subdirectory(lib/mpegts)
 
-add_subdirectory(lib/webm_parser)
-
 if(CORE_SYSTEM_NAME STREQUAL ios OR CORE_SYSTEM_NAME STREQUAL darwin_embedded)
   set(BENTOUSESTCFS 1)
   add_subdirectory(lib/libbento4)
@@ -91,7 +93,6 @@
 
 list(APPEND DEPLIBS bento4)
 list(APPEND DEPLIBS mpegts)
-list(APPEND DEPLIBS webm_parser)
 
 build_addon(inputstream.adaptive ADP DEPLIBS)
 
--- /dev/null
+++ b/FindWEBM.cmake
@@ -0,0 +1,28 @@
+# - Try to find webm
+# Once done this will define
+#
+# WEBM_FOUND - system has libwebm
+# WEBM_INCLUDE_DIRS - the libwebm include directory
+# WEBM_LIBRARIES - The libwebm libraries
+
+if(PKG_CONFIG_FOUND)
+  pkg_check_modules(PC_WEBM libwebm QUIET)
+endif()
+
+find_path(WEBM_INCLUDE_DIR webm/webm_parser.h PATHS ${PC_WEBM_INCLUDEDIR})
+find_library(WEBM_LIBRARY webm libwebm PATHS ${PC_WEBM_LIBDIR})
+
+set(WEBM_VERSION ${PC_WEBM_VERSION})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(WEBM
+                                  REQUIRED_VARS WEBM_INCLUDE_DIR WEBM_LIBRARY
+                                  VERSION_VAR WEBM_VERSION)
+
+if(WEBM_FOUND)
+  set(WEBM_LIBRARIES ${WEBM_LIBRARY})
+  set(WEBM_INCLUDE_DIRS ${WEBM_INCLUDE_DIR})
+endif()
+
+
+mark_as_advanced(WEBM_INCLUDE_DIRS WEBM_LIBRARIES)
