From d2c6b4041adc2a69997b7c22662dc3a86d61fb0e Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Sun, 3 Dec 2017 19:24:34 +0200 Subject: [PATCH] Switch to FindOpus.cmake --- CMakeLists.txt | 7 +------ Telegram/CMakeLists.txt | 2 +- modules/FindOpus.cmake | 13 +++++++++++++ 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 modules/FindOpus.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e6d81a17f..c1fed3edc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index b422c16d6..651276415 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -627,7 +627,7 @@ target_link_libraries(Telegram ${SWRESAMPLE_LIBRARIES} ${SWSCALE_LIBRARIES} ${OPENSSL_LIBRARIES} - ${OPUS_LIB} + ${OPUS_LIBRARIES} ${CONAN_LIBS} ) # crashpad::crashpad_client) diff --git a/modules/FindOpus.cmake b/modules/FindOpus.cmake new file mode 100644 index 000000000..aaa85ec5c --- /dev/null +++ b/modules/FindOpus.cmake @@ -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)