FindSWResample.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. if(NOT SWRESAMPLE_INCLUDE_DIR OR NOT SWRESAMPLE_LIBRARY)
  13. # Find the libswresample include files
  14. find_path(SWRESAMPLE_INCLUDE_DIR
  15. NAMES "libswresample/swresample.h"
  16. PATHS "/usr/include"
  17. "/usr/local/include"
  18. "/sw/include"
  19. "/opt/include"
  20. "/opt/local/include"
  21. "/opt/csw/include"
  22. PATH_SUFFIXES "libav" "ffmpeg"
  23. )
  24. # Find the libswresample library
  25. find_library(SWRESAMPLE_LIBRARY
  26. NAMES "swresample"
  27. PATHS "/usr"
  28. "/usr/local"
  29. "/usr/freeware"
  30. "/sw"
  31. "/opt"
  32. "/opt/csw"
  33. PATH_SUFFIXES "lib" "lib32" "lib64"
  34. )
  35. mark_as_advanced(SWRESAMPLE_INCLUDE_DIR)
  36. mark_as_advanced(SWRESAMPLE_LIBRARY)
  37. endif()
  38. # Translate library into library directory
  39. if(SWRESAMPLE_LIBRARY)
  40. unset(SWRESAMPLE_LIBRARY_DIR CACHE)
  41. get_filename_component(SWRESAMPLE_LIBRARY_DIR "${SWRESAMPLE_LIBRARY}" PATH)
  42. set(SWRESAMPLE_LIBRARY_DIR "${SWRESAMPLE_LIBRARY_DIR}" CACHE PATH "The path to libffmpeg's library directory.") # Library path
  43. endif()
  44. mark_as_advanced(SWRESAMPLE_LIBRARY_DIR)
  45. include(FindPackageHandleStandardArgs)
  46. find_package_handle_standard_args(SWResample DEFAULT_MSG SWRESAMPLE_LIBRARY SWRESAMPLE_INCLUDE_DIR SWRESAMPLE_LIBRARY_DIR)