| 1 |
#[[ |
| 2 |
A module to look for Vorbis |
| 3 |
]] |
| 4 |
|
| 5 |
if( NOT Vorbis_FOUND ) |
| 6 |
include( FindPackageHandleStandardArgs ) |
| 7 |
|
| 8 |
find_package( Ogg QUIET ) |
| 9 |
|
| 10 |
find_package( PkgConfig QUIET ) |
| 11 |
|
| 12 |
pkg_check_modules( PC_Vorbis_Vorbis QUIET vorbis >= 1.3 ) |
| 13 |
pkg_check_modules( PC_Vorbis_VorbisEnc QUIET vorbisenc >= 1.3 ) |
| 14 |
pkg_check_modules( PC_Vorbis_VorbisFile QUIET vorbisfile >= 1.3 ) |
| 15 |
|
| 16 |
find_path( Vorbis_Vorbis_INCLUDE_DIR vorbis/codec.h |
| 17 |
HINTS |
| 18 |
${PC_Vorbis_Vorbis_INCLUDE_DIRS} |
| 19 |
${VORBIS_ROOT} |
| 20 |
) |
| 21 |
|
| 22 |
find_library( Vorbis_Vorbis_LIBRARIES |
| 23 |
NAMES |
| 24 |
vorbis |
| 25 |
vorbis_static |
| 26 |
HINTS |
| 27 |
${PC_Vorbis_Vorbis_LIBRARY_DIRS} |
| 28 |
${VORBIS_ROOT} |
| 29 |
) |
| 30 |
|
| 31 |
find_path( Vorbis_VorbisEnc_INCLUDE_DIR vorbis/vorbisenc.h |
| 32 |
HINTS |
| 33 |
${PC_Vorbis_VorbisEnc_INCLUDE_DIRS} |
| 34 |
${VORBIS_ROOT} |
| 35 |
) |
| 36 |
|
| 37 |
find_library( Vorbis_VorbisEnc_LIBRARIES |
| 38 |
NAMES |
| 39 |
vorbisenc |
| 40 |
vorbisenc_static |
| 41 |
HINTS |
| 42 |
${PC_Vorbis_VorbisEnc_LIBRARY_DIRS} |
| 43 |
${VORBIS_ROOT} |
| 44 |
) |
| 45 |
|
| 46 |
find_path( Vorbis_VorbisFile_INCLUDE_DIR vorbis/vorbisfile.h |
| 47 |
HINTS |
| 48 |
${PC_Vorbis_VorbisFile_INCLUDE_DIRS} |
| 49 |
${VORBIS_ROOT} |
| 50 |
) |
| 51 |
|
| 52 |
find_library( Vorbis_VorbisFile_LIBRARIES |
| 53 |
NAMES |
| 54 |
vorbisfile |
| 55 |
vorbisfile_static |
| 56 |
HINTS |
| 57 |
${PC_Vorbis_VorbisFile_LIBRARY_DIRS} |
| 58 |
${VORBIS_ROOT} |
| 59 |
) |
| 60 |
|
| 61 |
find_package_handle_standard_args( |
| 62 |
Vorbis |
| 63 |
DEFAULT_MSG |
| 64 |
Ogg_FOUND |
| 65 |
Vorbis_Vorbis_INCLUDE_DIR |
| 66 |
Vorbis_Vorbis_LIBRARIES |
| 67 |
Vorbis_VorbisEnc_INCLUDE_DIR |
| 68 |
Vorbis_VorbisEnc_LIBRARIES |
| 69 |
Vorbis_VorbisFile_INCLUDE_DIR |
| 70 |
Vorbis_VorbisFile_LIBRARIES |
| 71 |
) |
| 72 |
|
| 73 |
if( Vorbis_FOUND ) |
| 74 |
if( NOT TARGET Vorbis::vorbis ) |
| 75 |
add_library( Vorbis::vorbis INTERFACE IMPORTED GLOBAL ) |
| 76 |
|
| 77 |
target_include_directories( Vorbis::vorbis INTERFACE ${Vorbis_Vorbis_INCLUDE_DIR} ) |
| 78 |
target_link_libraries( Vorbis::vorbis INTERFACE ${Vorbis_Vorbis_LIBRARIES} Ogg::ogg ) |
| 79 |
endif() |
| 80 |
|
| 81 |
if( NOT TARGET Vorbis::vorbisenc ) |
| 82 |
add_library( Vorbis::vorbisenc INTERFACE IMPORTED GLOBAL ) |
| 83 |
|
| 84 |
target_include_directories( Vorbis::vorbisenc INTERFACE ${Vorbis_VorbisEnc_INCLUDE_DIR} ) |
| 85 |
target_link_libraries( Vorbis::vorbisenc INTERFACE ${Vorbis_VorbisEnc_LIBRARIES} Vorbis::vorbis ) |
| 86 |
endif() |
| 87 |
|
| 88 |
if( NOT TARGET Vorbis::vorbisfile ) |
| 89 |
add_library( Vorbis::vorbisfile INTERFACE IMPORTED GLOBAL ) |
| 90 |
|
| 91 |
target_include_directories( Vorbis::vorbisfile INTERFACE ${Vorbis_VorbisFile_INCLUDE_DIR} ) |
| 92 |
target_link_libraries( Vorbis::vorbisfile INTERFACE ${Vorbis_VorbisFile_LIBRARIES} Vorbis::vorbis ) |
| 93 |
endif() |
| 94 |
|
| 95 |
mark_as_advanced( |
| 96 |
Vorbis_FOUND |
| 97 |
Vorbis_Vorbis_INCLUDE_DIR |
| 98 |
Vorbis_Vorbis_LIBRARIES |
| 99 |
Vorbis_VorbisEnc_INCLUDE_DIR |
| 100 |
Vorbis_VorbisEnc_LIBRARIES |
| 101 |
Vorbis_VorbisFile_INCLUDE_DIR |
| 102 |
Vorbis_VorbisFile_LIBRARIES |
| 103 |
) |
| 104 |
endif() |
| 105 |
endif() |