2
# CMake module to search for LIBVLC (VLC library)
3
# Authors: Rohit Yadav <rohityadav89@gmail.com>
4
# Harald Sitter <apachelogger@ubuntu.com>
6
# If it's found it sets LIBVLC_FOUND to TRUE
7
# and following variables are set:
12
if(NOT LIBVLC_MIN_VERSION)
13
set(LIBVLC_MIN_VERSION "0.0")
14
endif(NOT LIBVLC_MIN_VERSION)
16
# find_path and find_library normally search standard locations
17
# before the specified paths. To search non-standard paths first,
18
# FIND_* is invoked first with specified paths and NO_DEFAULT_PATH
19
# and then again with no specified paths to search the default
20
# locations. When an earlier FIND_* succeeds, subsequent FIND_*s
21
# searching for the same item do nothing.
24
find_package(PkgConfig)
25
pkg_check_modules(PC_LIBVLC libvlc)
26
set(LIBVLC_DEFINITIONS ${PC_LIBVLC_CFLAGS_OTHER})
29
#Put here path to custom location
30
#example: /home/user/vlc/include etc..
31
find_path(LIBVLC_INCLUDE_DIR vlc/vlc.h
32
HINTS "$ENV{LIBVLC_INCLUDE_PATH}"
34
"$ENV{LIB_DIR}/include"
35
"$ENV{LIB_DIR}/include/vlc"
39
"/usr/local/include/vlc"
43
find_path(LIBVLC_INCLUDE_DIR PATHS "${CMAKE_INCLUDE_PATH}/vlc" NAMES vlc.h
44
HINTS ${PC_LIBVLC_INCLUDEDIR} ${PC_LIBVLC_INCLUDE_DIRS})
46
#Put here path to custom location
47
#example: /home/user/vlc/lib etc..
48
find_library(LIBVLC_LIBRARY NAMES vlc libvlc
49
HINTS "$ENV{LIBVLC_LIBRARY_PATH}" ${PC_LIBVLC_LIBDIR} ${PC_LIBVLC_LIBRARY_DIRS}
55
find_library(LIBVLC_LIBRARY NAMES vlc libvlc)
56
find_library(LIBVLCCORE_LIBRARY NAMES vlccore libvlccore
57
HINTS "$ENV{LIBVLC_LIBRARY_PATH}" ${PC_LIBVLC_LIBDIR} ${PC_LIBVLC_LIBRARY_DIRS}
63
find_library(LIBVLCCORE_LIBRARY NAMES vlccore libvlccore)
65
set(LIBVLC_VERSION ${PC_LIBVLC_VERSION})
66
if (NOT LIBVLC_VERSION)
67
# TODO: implement means to detect version on windows (vlc --version && regex? ... ultimately we would get it from a header though...)
68
endif (NOT LIBVLC_VERSION)
70
if (LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY)
71
set(LIBVLC_FOUND TRUE)
72
else (LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY)
73
message(STATUS "LIBVLC INCLUDE DIR: ${LIBVLC_INCLUDE_DIR}")
74
message(STATUS "LIBVLC LIBRARY : ${LIBVLC_LIBRARY}")
75
message(STATUS "LIBVLC CORE LIBRARY : ${LIBVLCCORE_LIBRARY}")
76
endif (LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY)
78
if (LIBVLC_VERSION STRLESS "${LIBVLC_MIN_VERSION}")
79
message(WARNING "LibVLC version not found: version searched: ${LIBVLC_MIN_VERSION}, found ${LIBVLC_VERSION}\nUnless you are on Windows this is bound to fail.")
80
# TODO: only activate once version detection can be garunteed (which is currently not the case on windows)
81
# set(LIBVLC_FOUND FALSE)
82
endif (LIBVLC_VERSION STRLESS "${LIBVLC_MIN_VERSION}")
85
if (NOT LIBVLC_FIND_QUIETLY)
86
message(STATUS "Found LibVLC include-dir path: ${LIBVLC_INCLUDE_DIR}")
87
message(STATUS "Found LibVLC library path:${LIBVLC_LIBRARY}")
88
message(STATUS "Found LibVLCcore library path:${LIBVLCCORE_LIBRARY}")
89
message(STATUS "Found LibVLC version: ${LIBVLC_VERSION} (searched for: ${LIBVLC_MIN_VERSION})")
90
endif (NOT LIBVLC_FIND_QUIETLY)
92
if (LIBVLC_FIND_REQUIRED)
93
message(FATAL_ERROR "Could not find LibVLC")
94
endif (LIBVLC_FIND_REQUIRED)