FindTHEORA.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. include(CMakeFindDependencyMacro)
  2. find_dependency(OGG)
  3. find_path(THEORA_INCLUDE_DIR
  4. NAMES
  5. theora/theora.h
  6. DOC "theora include directory")
  7. mark_as_advanced(THEORA_INCLUDE_DIR)
  8. get_filename_component(computed_theora_root "${THEORA_INCLUDE_DIR}" DIRECTORY)
  9. find_library(THEORA_LIBRARY
  10. NAMES
  11. theora
  12. HINTS
  13. "${computed_theora_root}/lib"
  14. "${computed_theora_root}/lib64"
  15. DOC "theora library")
  16. mark_as_advanced(THEORA_LIBRARY)
  17. find_library(THEORA_enc_LIBRARY
  18. NAMES
  19. theoraenc
  20. HINTS
  21. "${computed_theora_root}/lib"
  22. "${computed_theora_root}/lib64"
  23. DOC "theora encoding library")
  24. mark_as_advanced(THEORA_enc_LIBRARY)
  25. find_library(THEORA_dec_LIBRARY
  26. NAMES
  27. theoradec
  28. HINTS
  29. "${computed_theora_root}/lib"
  30. "${computed_theora_root}/lib64"
  31. DOC "theora decoding library")
  32. mark_as_advanced(THEORA_dec_LIBRARY)
  33. include(FindPackageHandleStandardArgs)
  34. find_package_handle_standard_args(THEORA
  35. REQUIRED_VARS THEORA_LIBRARY THEORA_enc_LIBRARY THEORA_dec_LIBRARY THEORA_INCLUDE_DIR)
  36. if (THEORA_FOUND)
  37. set(THEORA_LIBRARIES "${THEORA_LIBRARY}" "${THEORA_enc_LIBRARY}" "${THEORA_dec_LIBRARY}")
  38. set(THEORA_INCLUDE_DIRS "${THEORA_INCLUDE_DIR}")
  39. if (NOT TARGET THEORA::THEORA)
  40. add_library(THEORA::THEORA UNKNOWN IMPORTED)
  41. set_target_properties(THEORA::THEORA PROPERTIES
  42. IMPORTED_LOCATION "${THEORA_LIBRARY}"
  43. INTERFACE_INCLUDE_DIRECTORIES ${THEORA_INCLUDE_DIR}
  44. INTERFACE_LINK_LIBRARIES OGG::OGG)
  45. endif ()
  46. if (NOT TARGET THEORA::ENC)
  47. add_library(THEORA::ENC UNKNOWN IMPORTED)
  48. set_target_properties(THEORA::ENC PROPERTIES
  49. IMPORTED_LOCATION "${THEORA_enc_LIBRARY}"
  50. INTERFACE_INCLUDE_DIRECTORIES ${THEORA_INCLUDE_DIR}
  51. INTERFACE_LINK_LIBRARIES OGG::OGG)
  52. endif()
  53. if (NOT TARGET THEORA::DEC)
  54. add_library(THEORA::DEC UNKNOWN IMPORTED)
  55. set_target_properties(THEORA::DEC PROPERTIES
  56. IMPORTED_LOCATION "${THEORA_dec_LIBRARY}"
  57. INTERFACE_INCLUDE_DIRECTORIES ${THEORA_INCLUDE_DIR})
  58. endif()
  59. endif ()