| 1 |
#[[ |
| 2 |
A module to look for Opus |
| 3 |
]] |
| 4 |
|
| 5 |
if( NOT Opus_FOUND ) |
| 6 |
include( FindPackageHandleStandardArgs) |
| 7 |
|
| 8 |
find_package( Ogg QUIET ) |
| 9 |
|
| 10 |
find_package( PkgConfig QUIET ) |
| 11 |
pkg_check_modules( PC_Opus QUIET opus >= 1.3 ) |
| 12 |
|
| 13 |
find_path( Opus_INCLUDE_DIR opus/opus.h |
| 14 |
HINTS |
| 15 |
${PC_Opus_INCLUDE_DIRS} |
| 16 |
${OPUS_ROOT} |
| 17 |
) |
| 18 |
|
| 19 |
find_library( Opus_LIBRARIES |
| 20 |
NAMES |
| 21 |
opus |
| 22 |
opus_static |
| 23 |
HINTS |
| 24 |
${PC_Opus_LIBRARY_DIRS} |
| 25 |
${OPUS_ROOT} |
| 26 |
) |
| 27 |
|
| 28 |
find_package_handle_standard_args( Opus DEFAULT_MSG Ogg_FOUND Opus_INCLUDE_DIR Opus_LIBRARIES ) |
| 29 |
|
| 30 |
if( Opus_FOUND ) |
| 31 |
if( NOT TARGET Opus::opus ) |
| 32 |
add_library( Opus::opus INTERFACE IMPORTED GLOBAL ) |
| 33 |
|
| 34 |
target_include_directories( Opus::opus INTERFACE ${Opus_INCLUDE_DIR} ) |
| 35 |
target_link_libraries( Opus::opus INTERFACE ${Opus_LIBRARIES} Ogg::ogg ) |
| 36 |
endif() |
| 37 |
|
| 38 |
mark_as_advanced( |
| 39 |
Opus_FOUND |
| 40 |
Opus_INCLUDE_DIR |
| 41 |
Opus_LIBRARIES |
| 42 |
) |
| 43 |
endif() |
| 44 |
endif() |