Switch to FindOpus.cmake

This commit is contained in:
Berkus Decker 2017-12-03 19:24:34 +02:00 committed by Berkus Decker
parent 53996d1983
commit d2c6b4041a
3 changed files with 15 additions and 7 deletions

View File

@ -29,9 +29,7 @@ find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(FFmpeg REQUIRED)
find_package(ZLIB REQUIRED)
#@todo Turn into find_package(Opus REQUIRED)
find_library(OPUS_LIB opus)
find_path(OPUS_INCLUDE_DIR opus/opus.h)
find_package(Opus REQUIRED)
if (NOT SWSCALE_FOUND)
message(FATAL_ERROR "FFmpeg swscale is required")
@ -39,8 +37,5 @@ endif()
if (NOT SWRESAMPLE_FOUND)
message(FATAL_ERROR "FFmpeg swresample is required")
endif()
if (NOT OPUS_LIB)
message(FATAL_ERROR "opus codec is required")
endif()
add_subdirectory(Telegram)

View File

@ -627,7 +627,7 @@ target_link_libraries(Telegram
${SWRESAMPLE_LIBRARIES}
${SWSCALE_LIBRARIES}
${OPENSSL_LIBRARIES}
${OPUS_LIB}
${OPUS_LIBRARIES}
${CONAN_LIBS}
) # crashpad::crashpad_client)

13
modules/FindOpus.cmake Normal file
View File

@ -0,0 +1,13 @@
# - Try to find Opus
# Once done this will define
#
# OPUS_FOUND - system has opus
# OPUS_INCLUDE_DIR - the opus include directory
# OPUS_LIBRARIES - Link these to use opus
include(FindPackageHandleStandardArgs)
find_library(OPUS_LIBRARIES opus)
find_path(OPUS_INCLUDE_DIR opus/opus.h)
find_package_handle_standard_args(Opus DEFAULT_MSG OPUS_INCLUDE_DIR OPUS_LIBRARIES)