2010-12-10 02:00:05 +00:00
|
|
|
include(FindPkgConfig OPTIONAL)
|
|
|
|
|
|
|
|
macro(_internal_message msg _quiet)
|
|
|
|
if(NOT _quiet)
|
|
|
|
message("${msg}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(check_lib var lib)
|
|
|
|
set(_is_required 0)
|
|
|
|
set(_is_quiet 0)
|
|
|
|
foreach(_arg ${ARGN})
|
|
|
|
if(_arg STREQUAL "REQUIRED")
|
|
|
|
set(_is_required 1)
|
|
|
|
endif()
|
|
|
|
if(_arg STREQUAL "QUIET")
|
|
|
|
set(_is_quiet 1)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
if(ARGN)
|
|
|
|
list(REMOVE_ITEM ${ARGN} "REQUIRED")
|
|
|
|
list(REMOVE_ITEM ${ARGN} "QUIET")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(PKG_CONFIG_FOUND AND NOT ${var}_FOUND)
|
|
|
|
string(TOLOWER ${lib} lower_lib)
|
|
|
|
pkg_search_module(${var} QUIET ${lower_lib})
|
|
|
|
endif()
|
|
|
|
|
2010-11-12 05:05:27 +00:00
|
|
|
if(${var}_FOUND)
|
2010-12-10 02:00:05 +00:00
|
|
|
_internal_message("${lib} found" _is_quiet)
|
2010-11-12 05:05:27 +00:00
|
|
|
else()
|
|
|
|
find_library(${var} ${lib})
|
2010-12-10 02:00:05 +00:00
|
|
|
foreach(_file ${ARGN})
|
|
|
|
find_path(${var}_INCLUDE ${_file})
|
|
|
|
endforeach()
|
|
|
|
if(${var} AND ${var}_INCLUDE)
|
|
|
|
_internal_message("${lib} found" _is_quiet)
|
2010-11-12 05:05:27 +00:00
|
|
|
set(${var}_FOUND 1 CACHE INTERNAL "")
|
|
|
|
else()
|
2010-12-10 02:00:05 +00:00
|
|
|
if(_is_required)
|
2010-11-12 05:05:27 +00:00
|
|
|
message(FATAL_ERROR "${lib} is required but not found")
|
|
|
|
else()
|
2010-12-10 02:00:05 +00:00
|
|
|
_internal_message("${lib} not found" _is_quiet)
|
2010-11-12 05:05:27 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2010-12-10 02:00:05 +00:00
|
|
|
macro(check_libav)
|
|
|
|
if(PKG_CONFIG_FOUND)
|
|
|
|
pkg_check_modules(LIBAV libavcodec>=52.72.2 libavformat>=52.64.2
|
|
|
|
libswscale>=0.11.0 libavutil>=50.15.1)
|
2010-11-18 23:27:27 +00:00
|
|
|
else()
|
2010-12-10 02:00:05 +00:00
|
|
|
message("pkg-config is required to check for libav")
|
|
|
|
endif()
|
|
|
|
if(LIBAV_FOUND)
|
|
|
|
message("libav found, enabling AVI frame dumps")
|
|
|
|
add_definitions(-DHAVE_LIBAV)
|
|
|
|
else()
|
|
|
|
message("libav not found, disabling AVI frame dumps")
|
2010-11-18 23:27:27 +00:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|