File: FindGPhoto2PkgConfig.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 (140 lines) | stat: -rw-r--r-- 3,974 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
###############################################################################
# CMake file to find the GStreamer files on the Linux platform.               #
# (c) Ralf Lange, longsoft.de                                                 #
# Last update: 2014-12-28                                                     #
#                                                                             #
###############################################################################
#
# Originally based on the findGPHOTO2.cmake from the KDE project
#
# cmake macro to test if we use gphoto2
#  GPHOTO2_FOUND - system has the GPHOTO2 library
#  GPHOTO2_INCLUDE_DIR - the GPHOTO2 include directory
#  GPHOTO2_LIBRARIES - The libraries needed to use GPHOTO2
#
# Copyright (c) 2006, 2007 Laurent Montel, <montel@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
###############################################################################

MESSAGE("FindGPhoto2PkgConfig.cmake")

IF (GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIR)
    # In cache already
    SET(
        GPHOTO2_FOUND
        true
    )
    MESSAGE(STATUS "Found in cache: gphoto2 !")
    RETURN()
ENDIF (GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIR)

FIND_PROGRAM(
    GHOTO2CONFIG_EXECUTABLE
    NAMES
    gphoto2-config 
)
FIND_PROGRAM(
    GHOTO2PORTCONFIG_EXECUTABLE
    NAMES
    gphoto2-port-config
)

SET(GPHOTO2_LIBRARIES)
SET(GPHOTO2_INCLUDE_DIRS)

# If gphoto2-port-config and gphoto2-config have been found
IF (GHOTO2PORTCONFIG_EXECUTABLE AND GHOTO2CONFIG_EXECUTABLE)
    EXEC_PROGRAM(
        ${GHOTO2PORTCONFIG_EXECUTABLE}
        ARGS --libs
        RETURN_VALUE _return_VALUE
        OUTPUT_VARIABLE GPHOTO2PORT_LIBRARY
    )
    
    EXEC_PROGRAM(
        ${GHOTO2CONFIG_EXECUTABLE}
        ARGS --libs
        RETURN_VALUE _return_VALUE
        OUTPUT_VARIABLE GPHOTO2_LIBRARY
    )
    
    EXEC_PROGRAM(
        ${GHOTO2PORTCONFIG_EXECUTABLE}
        ARGS --cflags
        RETURN_VALUE _return_VALUE
        OUTPUT_VARIABLE _GPHOTO2PORT_RESULT_INCLUDE_DIR
    )
    
    EXEC_PROGRAM(
        ${GHOTO2CONFIG_EXECUTABLE}
        ARGS --cflags
        RETURN_VALUE _return_VALUE
        OUTPUT_VARIABLE _GPHOTO2_RESULT_INCLUDE_DIR
    )
    
    SET(
        GPHOTO2_LIBRARIES
        ${GPHOTO2PORT_LIBRARY}
        ${GPHOTO2_LIBRARY}
    )
    
    # the cflags for poppler-qt4 can contain more than one include path
    SEPARATE_ARGUMENTS(_GPHOTO2_RESULT_INCLUDE_DIR)
    FOREACH(_includedir ${_GPHOTO2_RESULT_INCLUDE_DIR})
        STRING(
            REGEX REPLACE "-I(.+)" "\\1"
            _includedir
            "${_includedir}"
        )
        SET(
            GPHOTO2_INCLUDE_DIR
            ${GPHOTO2_INCLUDE_DIR}
            ${_includedir}
        )
    ENDFOREACH(_includedir)
    
    SEPARATE_ARGUMENTS(_GPHOTO2PORT_RESULT_INCLUDE_DIR)
    FOREACH(_includedir ${_GPHOTO2PORT_RESULT_INCLUDE_DIR})
        STRING(
            REGEX REPLACE "-I(.+)" "\\1"
            _includedir
            "${_includedir}"
        )
        SET(
            GPHOTO2PORT_INCLUDE_DIR
            ${GPHOTO2PORT_INCLUDE_DIR}
            ${_includedir}
        )
    ENDFOREACH(_includedir)

    SET(
        GPHOTO2_INCLUDE_DIRS
        ${GPHOTO2PORT_INCLUDE_DIR}
        ${GPHOTO2_INCLUDE_DIR}
    )
ENDIF(GHOTO2PORTCONFIG_EXECUTABLE AND GHOTO2CONFIG_EXECUTABLE)

IF (GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIRS)
    SET(
        GPHOTO2_FOUND
        true
    )
    MESSAGE(STATUS "Found: gphoto2 !")
    MESSAGE(STATUS "GPHOTO2_LIBRARIES: ${GPHOTO2_LIBRARIES}")
    MESSAGE(STATUS "GPHOTO2_INCLUDE_DIRS: ${GPHOTO2_INCLUDE_DIRS}")
ELSE (GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIRS)
    SET(
        GPHOTO2_FOUND
        false
    )
    MESSAGE(SEND_ERROR "Not found: gphoto2 !")
ENDIF (GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIRS)

MARK_AS_ADVANCED(
    GPHOTO2_LIBRARIES
    GPHOTO2_INCLUDE_DIRS
)