]> git.sesse.net Git - vlc/blob - bindings/phonon/cmake/modules/FindVLC.cmake
Phonon Backend using VLC
[vlc] / bindings / phonon / cmake / modules / FindVLC.cmake
1 # - Try to find VLC library
2 # Once done this will define
3 #
4 #  VLC_FOUND - system has VLC
5 #  VLC_INCLUDE_DIR - The VLC include directory
6 #  VLC_LIBRARIES - The libraries needed to use VLC
7 #  VLC_DEFINITIONS - Compiler switches required for using VLC
8 #
9 # Copyright (C) 2008, Tanguy Krotoff <tkrotoff@gmail.com>
10 # Copyright (C) 2008, Lukas Durfina <lukas.durfina@gmail.com>
11 # Copyright (c) 2009, Fathi Boudra <fboudra@gmail.com>
12 #
13 # Redistribution and use is allowed according to the terms of the BSD license.
14 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15 #
16
17 if(VLC_INCLUDE_DIR AND VLC_LIBRARIES)
18    # in cache already
19    set(VLC_FIND_QUIETLY TRUE)
20 endif(VLC_INCLUDE_DIR AND VLC_LIBRARIES)
21
22 # use pkg-config to get the directories and then use these values
23 # in the FIND_PATH() and FIND_LIBRARY() calls
24 if(NOT WIN32)
25   find_package(PkgConfig)
26   pkg_check_modules(VLC libvlc>=1.0.0)
27   set(VLC_DEFINITIONS ${VLC_CFLAGS})
28 endif(NOT WIN32)
29
30 # TODO add argument support to pass version on find_package
31 include(MacroEnsureVersion)
32 macro_ensure_version(1.0.0 ${VLC_VERSION} VLC_VERSION_OK)
33 if(VLC_VERSION_OK)
34   set(VLC_FOUND TRUE)
35   message(STATUS "VLC library found")
36 else(VLC_VERSION_OK)
37   set(VLC_FOUND FALSE)
38   message(FATAL_ERROR "VLC library not found")
39 endif(VLC_VERSION_OK)
40
41 find_path(VLC_INCLUDE_DIR
42           NAMES vlc.h
43           PATHS ${VLC_INCLUDE_DIRS}
44           PATH_SUFFIXES vlc)
45
46 find_library(VLC_LIBRARIES
47              NAMES vlc
48              PATHS ${VLC_LIBRARY_DIRS})
49
50 include(FindPackageHandleStandardArgs)
51 find_package_handle_standard_args(VLC DEFAULT_MSG VLC_INCLUDE_DIR VLC_LIBRARIES)
52
53 # show the VLC_INCLUDE_DIR and VLC_LIBRARIES variables only in the advanced view
54 mark_as_advanced(VLC_INCLUDE_DIR VLC_LIBRARIES)