]> git.sesse.net Git - vlc/blob - extras/buildsystem/cmake/include/FindMatroska.cmake
cmake: Detect matroska.
[vlc] / extras / buildsystem / cmake / include / FindMatroska.cmake
1 # - Find library containing Matroska()
2 # The following variables are set if Matroska is found. If Matroska is not
3 # found, Matroska_FOUND is set to false.
4 #  Matroska_FOUND     - System has Matroska.
5 #  Matroska_LIBRARIES - Link these to use Matroska.
6 #  Matroska_CFLAGS - Link these to use Matroska.
7
8
9 if (NOT Matroska_SEARCHED)
10     include(CheckLibraryExists)
11
12     set(Matroska_SEARCHED TRUE CACHE INTERNAL "")
13     set(Matroska_FOUND FALSE CACHE INTERNAL "")
14
15     pkg_check_modules(matroska libmatroska)
16
17     if (NOT Matroska_FOUND)
18         set(Matroska_LIBRARIES "")
19         find_library( matroska_LIBRARY matroska )
20         if (matroska_LIBRARY)
21               set(Matroska_LIBRARIES "${matroska_LIBRARY}")
22               set(Matroska_FOUND TRUE CACHE INTERNAL "")
23         endif (matroska_LIBRARY)
24         foreach (library ebml ebml_pic)
25             find_library( ${library}_LIBRARY ${library} )
26             if (${library}_LIBRARY)
27               set(Matroska_LIBRARIES "${library};${Matroska_LIBRARIES}")
28             endif (${library}_LIBRARY)
29         endforeach (library)
30         set(Matroska_LIBRARIES "${Matroska_LIBRARIES}" CACHE INTERNAL STRING)
31     endif (NOT Matroska_FOUND)
32
33     if (Matroska_FOUND)
34       if (NOT Matroska_FIND_QUIETLY)
35         message(STATUS "Found Matroska in: ${Matroska_LIBRARIES}")
36       endif (NOT Matroska_FIND_QUIETLY)
37     else (Matroska_FOUND)
38       if (Matroska_FIND_REQUIRED)
39         message(FATAL_ERROR "Could not find the library containing Matroska")
40       endif (Matroska_FIND_REQUIRED)
41     endif (Matroska_FOUND)
42
43     mark_as_advanced(Matroska_LIBRARIES)
44 endif(NOT Matroska_SEARCHED)