cmake: Detect matroska.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 9 Feb 2008 00:07:43 +0000 (00:07 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 9 Feb 2008 00:07:43 +0000 (00:07 +0000)
extras/buildsystem/cmake/include/FindMatroska.cmake [new file with mode: 0644]
extras/buildsystem/cmake/include/config.cmake

diff --git a/extras/buildsystem/cmake/include/FindMatroska.cmake b/extras/buildsystem/cmake/include/FindMatroska.cmake
new file mode 100644 (file)
index 0000000..5c9c447
--- /dev/null
@@ -0,0 +1,44 @@
+# - Find library containing Matroska()
+# The following variables are set if Matroska is found. If Matroska is not
+# found, Matroska_FOUND is set to false.
+#  Matroska_FOUND     - System has Matroska.
+#  Matroska_LIBRARIES - Link these to use Matroska.
+#  Matroska_CFLAGS - Link these to use Matroska.
+
+
+if (NOT Matroska_SEARCHED)
+    include(CheckLibraryExists)
+
+    set(Matroska_SEARCHED TRUE CACHE INTERNAL "")
+    set(Matroska_FOUND FALSE CACHE INTERNAL "")
+
+    pkg_check_modules(matroska libmatroska)
+
+    if (NOT Matroska_FOUND)
+        set(Matroska_LIBRARIES "")
+        find_library( matroska_LIBRARY matroska )
+        if (matroska_LIBRARY)
+              set(Matroska_LIBRARIES "${matroska_LIBRARY}")
+              set(Matroska_FOUND TRUE CACHE INTERNAL "")
+        endif (matroska_LIBRARY)
+        foreach (library ebml ebml_pic)
+            find_library( ${library}_LIBRARY ${library} )
+            if (${library}_LIBRARY)
+              set(Matroska_LIBRARIES "${library};${Matroska_LIBRARIES}")
+            endif (${library}_LIBRARY)
+        endforeach (library)
+        set(Matroska_LIBRARIES "${Matroska_LIBRARIES}" CACHE INTERNAL STRING)
+    endif (NOT Matroska_FOUND)
+
+    if (Matroska_FOUND)
+      if (NOT Matroska_FIND_QUIETLY)
+        message(STATUS "Found Matroska in: ${Matroska_LIBRARIES}")
+      endif (NOT Matroska_FIND_QUIETLY)
+    else (Matroska_FOUND)
+      if (Matroska_FIND_REQUIRED)
+        message(FATAL_ERROR "Could not find the library containing Matroska")
+      endif (Matroska_FIND_REQUIRED)
+    endif (Matroska_FOUND)
+
+    mark_as_advanced(Matroska_LIBRARIES)
+endif(NOT Matroska_SEARCHED)
index e874859..61bdea4 100644 (file)
@@ -425,6 +425,7 @@ if(QT4_FOUND)
   vlc_enable_modules(qt4)
   vlc_add_module_compile_flag(qt4 ${QT_CFLAGS} )
   vlc_module_add_link_libraries(qt4 ${QT_LIBRARIES})
+
   # Define our own qt4_wrap_ui macro to match wanted behaviour
   MACRO (VLC_QT4_WRAP_UI outfiles )
     FOREACH (it ${ARGN})
@@ -438,7 +439,6 @@ if(QT4_FOUND)
         MAIN_DEPENDENCY ${infile})
       SET(${outfiles} ${${outfiles}} ${outfile})
     ENDFOREACH (it)
-
   ENDMACRO (VLC_QT4_WRAP_UI)
 
 endif(QT4_FOUND)
@@ -453,6 +453,14 @@ if(OPENGL_FOUND)
   vlc_module_add_link_libraries(opengl ${OPENGL_LIBRARIES})
 endif(OPENGL_FOUND)
 
+find_package(Matroska 0.7.7)
+if(Matroska_FOUND)
+  vlc_enable_modules(mkv)
+  vlc_check_include_files (matroska/KaxAttachments.h)
+  vlc_check_include_files (matroska/KaxVersion.h)
+  vlc_module_add_link_libraries(mkv ${Matroska_LIBRARIES})
+endif(Matroska_FOUND)
+
 set(CMAKE_REQUIRED_INCLUDES)
 
 ###########################################################