-
-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,39 @@ | ||
# - Try to find the Opus library | ||
# Once done this will define | ||
# | ||
# OPUS_FOUND - system has Opus | ||
# OPUS_INCLUDE_DIR - the OggOpus include directory | ||
# OPUS_LIBRARY - The Opus library | ||
# Opus_FOUND - system has Opus | ||
# Opus_INCLUDE_DIR - the OggOpus include directory | ||
# Opus_LIBRARY - The Opus library | ||
# | ||
# Also creates the imported Opus::opus target | ||
|
||
find_path(OPUS_INCLUDE_DIR opus/opus.h) | ||
find_library(OPUS_LIBRARY NAMES opus) | ||
# Try config mode first! | ||
find_package(Opus CONFIG QUIET) # Deliberately quiet, so we can handle the result | ||
if(Opus_FOUND) | ||
if (TARGET Opus::opus) | ||
# CONFIG mode succeeded | ||
if(NOT Opus_INCLUDE_DIR) | ||
get_target_property(Opus_INCLUDE_DIR Opus::opus INTERFACE_INCLUDE_DIRECTORIES) | ||
endif() | ||
if(NOT Opus_LIBRARY) | ||
set(Opus_LIBRARY Opus::opus) | ||
endif() | ||
message(STATUS "Found Opus: ${Opus_INCLUDE_DIR}") | ||
return() | ||
endif() | ||
endif() | ||
|
||
mark_as_advanced(OPUS_INCLUDE_DIR OPUS_LIBRARY) | ||
find_path(Opus_INCLUDE_DIR opus/opus.h) | ||
find_library(Opus_LIBRARY NAMES opus) | ||
|
||
mark_as_advanced(Opus_INCLUDE_DIR Opus_LIBRARY) | ||
|
||
add_library(Opus::opus UNKNOWN IMPORTED) | ||
set_target_properties(Opus::opus | ||
PROPERTIES | ||
IMPORTED_LOCATION "${OPUS_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${OPUS_INCLUDE_DIR}" | ||
IMPORTED_LOCATION "${Opus_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${Opus_INCLUDE_DIR}" | ||
) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Opus REQUIRED_VARS OPUS_LIBRARY OPUS_INCLUDE_DIR) | ||
find_package_handle_standard_args(Opus REQUIRED_VARS Opus_LIBRARY Opus_INCLUDE_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters