diff options
author | Filip Gawin <filip.gawin@zoho.com> | 2021-01-14 15:22:02 +0100 |
---|---|---|
committer | Filip Gawin <filip.gawin@zoho.com> | 2021-01-14 15:22:02 +0100 |
commit | 57cc70c6af777247579d4ddf96b79bd9c6b7f692 (patch) | |
tree | 9ad6dd4213e2dbbc9b1033ba989c811031023c68 /cmake/Findopusfile.cmake | |
parent | Get rid of travis (diff) | |
download | re3-57cc70c6af777247579d4ddf96b79bd9c6b7f692.tar re3-57cc70c6af777247579d4ddf96b79bd9c6b7f692.tar.gz re3-57cc70c6af777247579d4ddf96b79bd9c6b7f692.tar.bz2 re3-57cc70c6af777247579d4ddf96b79bd9c6b7f692.tar.lz re3-57cc70c6af777247579d4ddf96b79bd9c6b7f692.tar.xz re3-57cc70c6af777247579d4ddf96b79bd9c6b7f692.tar.zst re3-57cc70c6af777247579d4ddf96b79bd9c6b7f692.zip |
Diffstat (limited to '')
-rw-r--r-- | cmake/Findopusfile.cmake | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/cmake/Findopusfile.cmake b/cmake/Findopusfile.cmake new file mode 100644 index 00000000..faae7645 --- /dev/null +++ b/cmake/Findopusfile.cmake @@ -0,0 +1,64 @@ +# - Try to find opusfile +# +# Once done this will define +# +# OPUSFILE_FOUND - system has opusfile +# OPUSFILE_INCLUDE_DIRS - the opusfile include directories +# OPUSFILE_LIBRARIES - Link these to use opusfile +# OPUSFILE_CFLAGS - Compile options to use opusfile +# opusfile::opusfile - Imported library of opusfile +# + +# FIXME: opusfile does not ship an official opusfile cmake script, +# rename this file/variables/target when/if it has. + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_search_module(PKG_OPUSFILE "opusfile") +endif() + +find_path(OPUSFILE_INCLUDE_DIR + NAMES + opusfile.h + PATH_SUFFIXES + opusfile + HINTS + ${PKG_OPUSFILE_INCLUDE_DIRS} + PATHS + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ) + +find_library(OPUSFILE_LIBRARY + NAMES + opusfile + HINTS + ${PKG_OPUSFILE_LIBRARIES} + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib +) + +set(OPUSFILE_CFLAGS "${PKG_OPUSFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of opusfile") + +set(OPUSFILE_INCLUDE_DIRS "${OPUSFILE_INCLUDE_DIR}") +set(OPUSFILE_LIBRARIES "${OPUSFILE_LIBRARY}") + +if (OPUSFILE_INCLUDE_DIRS AND OPUSFILE_LIBRARIES) +set(OPUSFILE_FOUND TRUE) +endif (OPUSFILE_INCLUDE_DIRS AND OPUSFILE_LIBRARIES) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(opusfile DEFAULT_MSG OPUSFILE_INCLUDE_DIRS OPUSFILE_LIBRARIES) + +if(NOT TARGET opusfile::opusfile) + add_library(__opusfile INTERFACE) + target_compile_options(__opusfile INTERFACE ${OPUSFILE_CFLAGS}) + target_include_directories(__opusfile INTERFACE ${OPUSFILE_INCLUDE_DIRS}) + target_link_libraries(__opusfile INTERFACE ${OPUSFILE_LIBRARIES}) + add_library(opusfile::opusfile ALIAS __opusfile) +endif() |