File: FindV4L2PkgConfig.cmake

package info (click to toggle)
qstopmotion 2.5.2-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,840 kB
  • sloc: cpp: 30,330; makefile: 3
file content (69 lines) | stat: -rw-r--r-- 1,920 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
###############################################################################
# CMake file to find the Video4Linux2 files on the Linux platform.            #
# (c) Ralf Lange, longsoft.de                                                 #
# Last update: 2014-12-28                                                     #
#                                                                             #
###############################################################################
#
# cmake macro to test if we use Video4Linux2
#  V4L2_FOUND - system has the Video4Linux2 library
#  V4L2_INCLUDE_DIR - the Video4Linux2 include directory
#  V4L2_LIBRARIES - The libraries needed to use Video4Linux2
#
###############################################################################

MESSAGE("FindV4L2PkgConfig.cmake")

FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(PKG_V4L2 QUIET libv4l2)

IF(PKG_V4L2_FOUND)
    MESSAGE(STATUS "FOUND: Video4Linux2 !")
ELSE(PKG_V4L2_FOUND)
    MESSAGE(SEND_ERROR "Not found: Video4Linux2 !")
    RETURN()
ENDIF(PKG_V4L2_FOUND)

FIND_PATH(
    V4L2_INCLUDE_DIR
    NAMES videodev2.h libv4l2.h libv4lconvert.h
    HINTS ${PKG_V4L2_INCLUDEDIR} ${PKG_V4L2_INCLUDE_DIRS}
    PATH_SUFFIXES v4l2 video4linux
)

FIND_LIBRARY(
    V4L2_LIBRARY
    NAMES v4l2 v4lconvert
    HINTS ${PKG_V4L2_LIBDIR} ${PKG_V4L2_LIBRARY_DIRS}
)

SET(
    V4L2_LIBRARIES
    ${V4L2_LIBRARY}
)

SET(
    V4L2_INCLUDE_DIRS
    ${V4L2_INCLUDE_DIR}
)

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set V4L2_FOUND to true
# if all listed variables are true
find_package_handle_standard_args(
    Libv4l2
    DEFAULT_MSG
    V4L2_LIBRARY
    V4L2_INCLUDE_DIR
)

IF(PKG_V4L2_FOUND)
    MESSAGE(STATUS "V4L2_LIBRARY: ${V4L2_LIBRARY}")
    MESSAGE(STATUS "V4L2_INCLUDE_DIR: ${V4L2_INCLUDE_DIR}")
ENDIF(PKG_V4L2_FOUND)

MARK_AS_ADVANCED(
    V4L2_LIBRARIES
    V4L2_INCLUDE_DIRS
)