Warning, /graphics/kamera/FindGphoto2.cmake is written in an unsupported language. File is not indexed.
0001 # cmake macro to detect gphoto2 libraries 0002 # GPHOTO2_FOUND - system has the GPHOTO2 library 0003 # GPHOTO2_INCLUDE_DIR - the GPHOTO2 include directory 0004 # GPHOTO2_LIBRARIES - The libraries needed to use GPHOTO2 0005 0006 # SPDX-FileCopyrightText: 2006, 2007 Laurent Montel <montel@kde.org> 0007 # 0008 # SPDX-License-Identifier: BSD-3-Clause 0009 0010 if(GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIR) 0011 0012 # in cache already 0013 set(GPHOTO2_FOUND TRUE) 0014 0015 else() 0016 0017 find_program(GHOTO2CONFIG_EXECUTABLE NAMES gphoto2-config) 0018 find_program(GHOTO2PORTCONFIG_EXECUTABLE NAMES gphoto2-port-config) 0019 0020 set(GPHOTO2_LIBRARIES) 0021 set(GPHOTO2_INCLUDE_DIRS) 0022 0023 # if gphoto2-port-config and gphoto2-config have been found 0024 if(GHOTO2PORTCONFIG_EXECUTABLE AND GHOTO2CONFIG_EXECUTABLE) 0025 0026 exec_program(${GHOTO2PORTCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GPHOTO2PORT_LIBRARY) 0027 exec_program(${GHOTO2CONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GPHOTO2_LIBRARY) 0028 exec_program(${GHOTO2PORTCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _GPHOTO2PORT_RESULT_INCLUDE_DIR) 0029 exec_program(${GHOTO2CONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _GPHOTO2_RESULT_INCLUDE_DIR) 0030 0031 set(GPHOTO2_LIBRARIES ${GPHOTO2PORT_LIBRARY} ${GPHOTO2_LIBRARY}) 0032 0033 # the cflags can contain more than one include path 0034 separate_arguments(_GPHOTO2_RESULT_INCLUDE_DIR) 0035 0036 foreach(_includedir ${_GPHOTO2_RESULT_INCLUDE_DIR}) 0037 string(REGEX REPLACE "-I(.+)" "\\1" _includedir "${_includedir}") 0038 set(GPHOTO2_INCLUDE_DIR ${GPHOTO2_INCLUDE_DIR} ${_includedir}) 0039 endforeach() 0040 0041 separate_arguments(_GPHOTO2PORT_RESULT_INCLUDE_DIR) 0042 0043 foreach(_includedir ${_GPHOTO2PORT_RESULT_INCLUDE_DIR}) 0044 string(REGEX REPLACE "-I(.+)" "\\1" _includedir "${_includedir}") 0045 set(GPHOTO2PORT_INCLUDE_DIR ${GPHOTO2PORT_INCLUDE_DIR} ${_includedir}) 0046 endforeach() 0047 0048 set(GPHOTO2_INCLUDE_DIRS ${GPHOTO2PORT_INCLUDE_DIR} ${GPHOTO2_INCLUDE_DIR} ) 0049 0050 endif() 0051 0052 if(GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIRS) 0053 set(GPHOTO2_FOUND TRUE) 0054 message(STATUS "Found gphoto2: ${GPHOTO2_LIBRARIES}") 0055 else() 0056 pkg_check_modules(GPHOTO2 QUIET libgphoto2) 0057 if(GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIRS) 0058 message(STATUS "Found gphoto2: ${GPHOTO2_LIBRARIES}") 0059 endif() 0060 endif() 0061 0062 endif() 0063 0064 mark_as_advanced(GPHOTO2_LIBRARIES GPHOTO2_INCLUDE_DIRS)