add some comments
[makneto-zunavac1.git] / CMakeMod / MacroFindGStreamerLibrary.cmake
blob761a80c27556ac33fb6cf61eaf1e20c171b31edc
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)
15     else()
16         set(_GSTREAMER_${_upper_name}_QUIET FALSE)
17     endif()
19     if (PKG_CONFIG_FOUND)
20         pkg_check_modules(PKG_GSTREAMER_${_upper_name} gstreamer-${_lower_name}-${_abi_version})
21     endif()
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}
27     )
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}
34     )
36     if (GSTREAMER_${_upper_name}_LIBRARY AND GSTREAMER_${_upper_name}_INCLUDE_DIR)
37         set(GSTREAMER_${_upper_name}_LIBRARY_FOUND TRUE)
38     else()
39         set(GSTREAMER_${_upper_name}_LIBRARY_FOUND FALSE)
40     endif()
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}")
45         else()
46             message(STATUS "Could NOT find GSTREAMER_${_upper_name}_LIBRARY")
47         endif()
49         if (GSTREAMER_${_upper_name}_INCLUDE_DIR)
50             message(STATUS "Found GSTREAMER_${_upper_name}_INCLUDE_DIR: ${GSTREAMER_${_upper_name}_INCLUDE_DIR}")
51         else()
52             message(STATUS "Could NOT find GSTREAMER_${_upper_name}_INCLUDE_DIR")
53         endif()
54     endif()
56     mark_as_advanced(GSTREAMER_${_upper_name}_LIBRARY GSTREAMER_${_upper_name}_INCLUDE_DIR)
57 endmacro()