File: FindOpus.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 (39 lines) | stat: -rw-r--r-- 1,107 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
# - Try to find the Opus library
# Once done this will define
#
#  Opus_FOUND - system has Opus
#  Opus_INCLUDE_DIR - the OggOpus include directory
#  Opus_LIBRARY      - The Opus library
#
# Also creates the imported Opus::opus target

# Try config mode first!
find_package(Opus CONFIG QUIET) # Deliberately quiet, so we can handle the result
if(Opus_FOUND)
	if (TARGET Opus::opus)
		# CONFIG mode succeeded
		if(NOT Opus_INCLUDE_DIR)
			get_target_property(Opus_INCLUDE_DIR Opus::opus INTERFACE_INCLUDE_DIRECTORIES)
		endif()
		if(NOT Opus_LIBRARY)
			set(Opus_LIBRARY Opus::opus)
		endif()
		message(STATUS "Found Opus: ${Opus_INCLUDE_DIR}")
		return()
	endif()
endif()

find_path(Opus_INCLUDE_DIR opus/opus.h)
find_library(Opus_LIBRARY NAMES opus)

mark_as_advanced(Opus_INCLUDE_DIR Opus_LIBRARY)

add_library(Opus::opus UNKNOWN IMPORTED)
set_target_properties(Opus::opus
  PROPERTIES
  IMPORTED_LOCATION "${Opus_LIBRARY}"
  INTERFACE_INCLUDE_DIRECTORIES "${Opus_INCLUDE_DIR}"
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Opus REQUIRED_VARS Opus_LIBRARY Opus_INCLUDE_DIR)