summaryrefslogtreecommitdiff
path: root/externals/find-modules/Findopus.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'externals/find-modules/Findopus.cmake')
-rw-r--r--externals/find-modules/Findopus.cmake42
1 files changed, 42 insertions, 0 deletions
diff --git a/externals/find-modules/Findopus.cmake b/externals/find-modules/Findopus.cmake
new file mode 100644
index 000000000..de84bd995
--- /dev/null
+++ b/externals/find-modules/Findopus.cmake
@@ -0,0 +1,42 @@
1
2find_package(PkgConfig QUIET)
3pkg_check_modules(PC_opus QUIET opus)
4
5find_path(opus_INCLUDE_DIR
6 NAMES opus.h
7 PATHS ${PC_opus_INCLUDE_DIRS}
8 PATH_SUFFIXES opus
9)
10find_library(opus_LIBRARY
11 NAMES opus
12 PATHS ${PC_opus_LIBRARY_DIRS}
13)
14
15include(FindPackageHandleStandardArgs)
16find_package_handle_standard_args(opus
17 FOUND_VAR opus_FOUND
18 REQUIRED_VARS
19 opus_LIBRARY
20 opus_INCLUDE_DIR
21 VERSION_VAR opus_VERSION
22)
23
24if(opus_FOUND)
25 set(Opus_LIBRARIES ${opus_LIBRARY})
26 set(Opus_INCLUDE_DIRS ${opus_INCLUDE_DIR})
27 set(Opus_DEFINITIONS ${PC_opus_CFLAGS_OTHER})
28endif()
29
30if(opus_FOUND AND NOT TARGET Opus::Opus)
31 add_library(Opus::Opus UNKNOWN IMPORTED)
32 set_target_properties(Opus::Opus PROPERTIES
33 IMPORTED_LOCATION "${opus_LIBRARY}"
34 INTERFACE_COMPILE_OPTIONS "${PC_opus_CFLAGS_OTHER}"
35 INTERFACE_INCLUDE_DIRECTORIES "${opus_INCLUDE_DIR}"
36 )
37endif()
38
39mark_as_advanced(
40 opus_INCLUDE_DIR
41 opus_LIBRARY
42)