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