FindMPEG2.cmake 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. Find the native MPEG2 includes and library
  7. This module defines
  8. ::
  9. MPEG2_INCLUDE_DIR, path to mpeg2dec/mpeg2.h, etc.
  10. MPEG2_LIBRARIES, the libraries required to use MPEG2.
  11. MPEG2_FOUND, If false, do not try to use MPEG2.
  12. also defined, but not for general use are
  13. ::
  14. MPEG2_mpeg2_LIBRARY, where to find the MPEG2 library.
  15. MPEG2_vo_LIBRARY, where to find the vo library.
  16. #]=======================================================================]
  17. find_path(MPEG2_INCLUDE_DIR
  18. NAMES mpeg2.h mpeg2dec/mpeg2.h)
  19. find_library(MPEG2_mpeg2_LIBRARY mpeg2)
  20. find_library(MPEG2_vo_LIBRARY vo)
  21. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  22. FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR)
  23. if(MPEG2_FOUND)
  24. set(MPEG2_LIBRARIES ${MPEG2_mpeg2_LIBRARY})
  25. if(MPEG2_vo_LIBRARY)
  26. list(APPEND MPEG2_LIBRARIES ${MPEG2_vo_LIBRARY})
  27. endif()
  28. #some native mpeg2 installations will depend
  29. #on libSDL, if found, add it in.
  30. find_package(SDL)
  31. if(SDL_FOUND)
  32. set( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY})
  33. endif()
  34. endif()
  35. mark_as_advanced(MPEG2_INCLUDE_DIR MPEG2_mpeg2_LIBRARY MPEG2_vo_LIBRARY)