Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
graph/cmake/Findopus.cmake

43 lines
1.3 KiB
CMake
Executable file

# - FindOpus.cmake
# Find the native opus includes and libraries
#
# OPUS_INCLUDE_DIRS - where to find opus/opus.h, etc.
# OPUS_LIBRARIES - List of libraries when using libopus(file).
# OPUS_FOUND - True if libopus found.
if(OPUS_INCLUDE_DIR AND OPUS_LIBRARY)
# Already in cache, be silent
set(OPUS_FIND_QUIETLY TRUE)
endif(OPUS_INCLUDE_DIR AND OPUS_LIBRARY)
find_path(OPUS_INCLUDE_DIR
NAMES opus.h
PATH_SUFFIXES opus include/opus include
)
# MSVC built opus may be named opus_static
# The provided project files name the library with the lib prefix.
find_library(OPUS_LIBRARY
NAMES opus opus_static libopus libopus_static
PATH_SUFFIXES lib64 lib libs64 libs
)
# Handle the QUIETLY and REQUIRED arguments and set OPUS_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OPUS DEFAULT_MSG
OPUS_LIBRARY OPUS_INCLUDE_DIR
)
if(OPUS_FOUND)
set(OPUS_LIBRARIES ${OPUS_LIBRARY})
set(OPUS_INCLUDE_DIRS ${OPUS_INCLUDE_DIR})
add_library(opus::opus UNKNOWN IMPORTED)
set_target_properties(opus::opus PROPERTIES
IMPORTED_LOCATION "${OPUS_LIBRARY}")
set_target_properties(opus::opus PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${OPUS_INCLUDE_DIRS}
)
endif(OPUS_FOUND)