FindMPEG2.cmake 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #.rst:
  4. # FindMPEG2
  5. # ---------
  6. #
  7. # Find the native MPEG2 includes and library
  8. #
  9. # This module defines
  10. #
  11. # ::
  12. #
  13. # MPEG2_INCLUDE_DIR, path to mpeg2dec/mpeg2.h, etc.
  14. # MPEG2_LIBRARIES, the libraries required to use MPEG2.
  15. # MPEG2_FOUND, If false, do not try to use MPEG2.
  16. #
  17. # also defined, but not for general use are
  18. #
  19. # ::
  20. #
  21. # MPEG2_mpeg2_LIBRARY, where to find the MPEG2 library.
  22. # MPEG2_vo_LIBRARY, where to find the vo library.
  23. find_path(MPEG2_INCLUDE_DIR
  24. NAMES mpeg2.h mpeg2dec/mpeg2.h)
  25. find_library(MPEG2_mpeg2_LIBRARY mpeg2)
  26. find_library(MPEG2_vo_LIBRARY vo)
  27. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  28. FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR)
  29. if(MPEG2_FOUND)
  30. set(MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY})
  31. if(MPEG2_vo_LIBRARY)
  32. list(APPEND MPEG2_LIBRARIES ${MPEG2_vo_LIBRARY})
  33. endif()
  34. #some native mpeg2 installations will depend
  35. #on libSDL, if found, add it in.
  36. find_package(SDL)
  37. if(SDL_FOUND)
  38. set( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY})
  39. endif()
  40. endif()
  41. mark_as_advanced(MPEG2_INCLUDE_DIR MPEG2_mpeg2_LIBRARY MPEG2_vo_LIBRARY)