1 # - macro find_gstreamer_library
3 # Copyright (c) 2010, Collabora Ltd.
4 # @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
6 # Redistribution and use is allowed according to the terms of the BSD license.
7 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
9 macro(find_gstreamer_library _name _header _abi_version)
10 string(TOLOWER ${_name} _lower_name)
11 string(TOUPPER ${_name} _upper_name)
13 if (GSTREAMER_${_upper_name}_LIBRARY AND GSTREAMER_${_upper_name}_INCLUDE_DIR)
14 set(_GSTREAMER_${_upper_name}_QUIET TRUE)
16 set(_GSTREAMER_${_upper_name}_QUIET FALSE)
20 pkg_check_modules(PKG_GSTREAMER_${_upper_name} gstreamer-${_lower_name}-${_abi_version})
23 find_library(GSTREAMER_${_upper_name}_LIBRARY
24 NAMES gst${_lower_name}-${_abi_version}
25 HINTS ${PKG_GSTREAMER_${_upper_name}_LIBRARY_DIRS}
26 ${PKG_GSTREAMER_${_upper_name}_LIBDIR}
29 find_path(GSTREAMER_${_upper_name}_INCLUDE_DIR
30 gst/${_lower_name}/${_header}
31 HINTS ${PKG_GSTREAMER_${_upper_name}_INCLUDE_DIRS}
32 ${PKG_GSTREAMER_${_upper_name}_INCLUDEDIR}
33 PATH_SUFFIXES gstreamer-${_abi_version}
36 if (GSTREAMER_${_upper_name}_LIBRARY AND GSTREAMER_${_upper_name}_INCLUDE_DIR)
37 set(GSTREAMER_${_upper_name}_LIBRARY_FOUND TRUE)
39 set(GSTREAMER_${_upper_name}_LIBRARY_FOUND FALSE)
42 if (NOT _GSTREAMER_${_upper_name}_QUIET)
43 if (GSTREAMER_${_upper_name}_LIBRARY)
44 message(STATUS "Found GSTREAMER_${_upper_name}_LIBRARY: ${GSTREAMER_${_upper_name}_LIBRARY}")
46 message(STATUS "Could NOT find GSTREAMER_${_upper_name}_LIBRARY")
49 if (GSTREAMER_${_upper_name}_INCLUDE_DIR)
50 message(STATUS "Found GSTREAMER_${_upper_name}_INCLUDE_DIR: ${GSTREAMER_${_upper_name}_INCLUDE_DIR}")
52 message(STATUS "Could NOT find GSTREAMER_${_upper_name}_INCLUDE_DIR")
56 mark_as_advanced(GSTREAMER_${_upper_name}_LIBRARY GSTREAMER_${_upper_name}_INCLUDE_DIR)