File: FindOpusfile.cmake

package info (click to toggle)
warzone2100 4.6.3-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 660,328 kB
  • sloc: cpp: 676,209; ansic: 391,201; javascript: 78,238; python: 16,632; php: 4,294; sh: 4,094; makefile: 2,629; lisp: 1,492; cs: 489; xml: 404; perl: 224; ruby: 156; java: 89
file content (43 lines) | stat: -rw-r--r-- 1,481 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# - Try to find the Opusfile library
# Once done this will define:
#
#  OPUSFILE_FOUND - system has Opusfile
#  OPUSFILE_INCLUDE_DIR - the Opusfile include directory
#  OPUSFILE_LIBRARY  - The Opusfile library
#
# Plus the Opus::opusfile target
#

include (CheckLibraryExists)

find_path(OPUSFILE_INCLUDE_DIR opusfile.h PATH_SUFFIXES opus)

# opusfile.h includes "opus_multistream.h" instead of "opus/opus_multistream.h"
# so we must include the path to opus_multistream.h
find_path(OPUS_MULTISTREAM_DIR opus_multistream.h PATH_SUFFIXES opus)

find_library(OPUSFILE_LIBRARY NAMES opusfile)
if (NOT TARGET Ogg::ogg)
	find_package(Ogg REQUIRED)
endif()
if (NOT TARGET Opus::opus)
	find_package(Opus REQUIRED)
endif()

mark_as_advanced(OPUSFILE_INCLUDE_DIR OPUSFILE_LIBRARY)

list(APPEND _opusfile_interface_include_directories "${OPUSFILE_INCLUDE_DIR}")
list(APPEND _opusfile_interface_include_directories "${OPUS_MULTISTREAM_DIR}")
list(APPEND _opusfile_link_libraries "Ogg::ogg" "Opus::opus")
add_library(Opus::opusfile UNKNOWN IMPORTED)
set_target_properties(Opus::opusfile
  PROPERTIES
  IMPORTED_LOCATION "${OPUSFILE_LIBRARY}"
  INTERFACE_INCLUDE_DIRECTORIES "${_opusfile_interface_include_directories}"
  INTERFACE_LINK_LIBRARIES "${_opusfile_link_libraries}"
)
unset(_opusfile_interface_include_directories)
unset(_opusfile_link_libraries)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Opusfile REQUIRED_VARS OPUSFILE_LIBRARY OPUSFILE_INCLUDE_DIR)