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 # Copyright (c) 2006, 2007 Laurent Montel, <montel@kde.org>
0007 #
0008 # Redistribution and use is allowed according to the terms of the BSD license.
0009 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0010 
0011 if(GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIR)
0012 
0013     # in cache already
0014     set(GPHOTO2_FOUND TRUE)
0015 
0016 else()
0017 
0018     find_program(GHOTO2CONFIG_EXECUTABLE     NAMES gphoto2-config)
0019     find_program(GHOTO2PORTCONFIG_EXECUTABLE NAMES gphoto2-port-config)
0020 
0021     set(GPHOTO2_LIBRARIES)
0022     set(GPHOTO2_INCLUDE_DIRS)
0023 
0024     # if gphoto2-port-config and gphoto2-config have been found
0025     if(GHOTO2PORTCONFIG_EXECUTABLE AND GHOTO2CONFIG_EXECUTABLE)
0026 
0027         exec_program(${GHOTO2PORTCONFIG_EXECUTABLE} ARGS --libs   RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GPHOTO2PORT_LIBRARY)
0028         exec_program(${GHOTO2CONFIG_EXECUTABLE}     ARGS --libs   RETURN_VALUE _return_VALUE OUTPUT_VARIABLE GPHOTO2_LIBRARY)
0029         exec_program(${GHOTO2PORTCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _GPHOTO2PORT_RESULT_INCLUDE_DIR)
0030         exec_program(${GHOTO2CONFIG_EXECUTABLE}     ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _GPHOTO2_RESULT_INCLUDE_DIR)
0031 
0032         set(GPHOTO2_LIBRARIES ${GPHOTO2PORT_LIBRARY} ${GPHOTO2_LIBRARY})
0033 
0034         # the cflags can contain more than one include path
0035         separate_arguments(_GPHOTO2_RESULT_INCLUDE_DIR)
0036 
0037         foreach(_includedir ${_GPHOTO2_RESULT_INCLUDE_DIR})
0038             string(REGEX REPLACE "-I(.+)" "\\1" _includedir "${_includedir}")
0039             set(GPHOTO2_INCLUDE_DIR ${GPHOTO2_INCLUDE_DIR} ${_includedir})
0040         endforeach()
0041 
0042         separate_arguments(_GPHOTO2PORT_RESULT_INCLUDE_DIR)
0043 
0044         foreach(_includedir ${_GPHOTO2PORT_RESULT_INCLUDE_DIR})
0045             string(REGEX REPLACE "-I(.+)" "\\1" _includedir "${_includedir}")
0046             set(GPHOTO2PORT_INCLUDE_DIR ${GPHOTO2PORT_INCLUDE_DIR} ${_includedir})
0047         endforeach()
0048 
0049         set(GPHOTO2_INCLUDE_DIRS ${GPHOTO2PORT_INCLUDE_DIR} ${GPHOTO2_INCLUDE_DIR} )
0050 
0051     endif()
0052 
0053     if(GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIRS)
0054         set(GPHOTO2_FOUND TRUE)
0055         message(STATUS "Found gphoto2: ${GPHOTO2_LIBRARIES}")
0056     else()
0057         pkg_check_modules(GPHOTO2 QUIET libgphoto2)
0058         if(GPHOTO2_LIBRARIES AND GPHOTO2_INCLUDE_DIRS)
0059             message(STATUS "Found gphoto2: ${GPHOTO2_LIBRARIES}")
0060         endif()
0061     endif()
0062 
0063 endif()
0064 
0065 mark_as_advanced(GPHOTO2_LIBRARIES GPHOTO2_INCLUDE_DIRS)