FindSWResample.cmake 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Filename: FindSWResample.cmake
  2. # Author: CFSworks (10 Apr, 2014)
  3. #
  4. # Usage:
  5. # find_package(SWResample [REQUIRED] [QUIET])
  6. #
  7. # Once done this will define:
  8. # SWRESAMPLE_FOUND - system has ffmpeg's libswresample
  9. # SWRESAMPLE_INCLUDE_DIR - the libswresample include directory
  10. # SWRESAMPLE_LIBRARY - the path to the library binary
  11. #
  12. # Find the libswresample include files
  13. find_path(SWRESAMPLE_INCLUDE_DIR
  14. NAMES "libswresample/swresample.h"
  15. PATHS "/usr/include"
  16. "/usr/local/include"
  17. "/sw/include"
  18. "/opt/include"
  19. "/opt/local/include"
  20. "/opt/csw/include"
  21. PATH_SUFFIXES "libav" "ffmpeg"
  22. )
  23. # Find the libswresample library
  24. find_library(SWRESAMPLE_LIBRARY
  25. NAMES "swresample"
  26. PATHS "/usr"
  27. "/usr/local"
  28. "/usr/freeware"
  29. "/sw"
  30. "/opt"
  31. "/opt/csw"
  32. PATH_SUFFIXES "lib" "lib32" "lib64"
  33. )
  34. mark_as_advanced(SWRESAMPLE_INCLUDE_DIR)
  35. mark_as_advanced(SWRESAMPLE_LIBRARY)
  36. # Translate library into library directory
  37. if(SWRESAMPLE_LIBRARY)
  38. unset(SWRESAMPLE_LIBRARY_DIR CACHE)
  39. get_filename_component(SWRESAMPLE_LIBRARY_DIR "${SWRESAMPLE_LIBRARY}" PATH)
  40. set(SWRESAMPLE_LIBRARY_DIR "${SWRESAMPLE_LIBRARY_DIR}" CACHE PATH "The path to libffmpeg's library directory.") # Library path
  41. endif()
  42. mark_as_advanced(SWRESAMPLE_LIBRARY_DIR)
  43. include(FindPackageHandleStandardArgs)
  44. find_package_handle_standard_args(SWResample DEFAULT_MSG SWRESAMPLE_LIBRARY SWRESAMPLE_INCLUDE_DIR SWRESAMPLE_LIBRARY_DIR)