|
| 1 | +# Try to find the soxr library |
| 2 | +# |
| 3 | +# Copyright 2018 Thincast Technologies GmbH |
| 4 | +# Copyright 2018 Armin Novak <armin.novak@thincast.com> |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# |
| 17 | +# Once done this will define |
| 18 | +# |
| 19 | +# SOXR_ROOT - A list of search hints |
| 20 | +# |
| 21 | +# SOXR_FOUND - system has soxr |
| 22 | +# SOXR_INCLUDE_DIR - the soxr include directory |
| 23 | +# SOXR_LIBRARIES - libsoxr library |
| 24 | + |
| 25 | +if (UNIX AND NOT ANDROID) |
| 26 | + find_package(PkgConfig QUIET) |
| 27 | + pkg_check_modules(PC_SOXR QUIET soxr) |
| 28 | +endif (UNIX AND NOT ANDROID) |
| 29 | + |
| 30 | +if (SOXR_INCLUDE_DIR AND SOXR_LIBRARY) |
| 31 | + set(SOXR_FIND_QUIETLY TRUE) |
| 32 | +endif (SOXR_INCLUDE_DIR AND SOXR_LIBRARY) |
| 33 | + |
| 34 | +find_path(SOXR_INCLUDE_DIR NAMES soxr.h |
| 35 | + PATH_SUFFIXES include |
| 36 | + HINTS ${SOXR_ROOT} ${PC_SOXR_INCLUDE_DIRS}) |
| 37 | +find_library(SOXR_LIBRARY |
| 38 | + NAMES soxr |
| 39 | + PATH_SUFFIXES lib |
| 40 | + HINTS ${SOXR_ROOT} ${PC_SOXR_LIBRARY_DIRS}) |
| 41 | + |
| 42 | +include(FindPackageHandleStandardArgs) |
| 43 | +FIND_PACKAGE_HANDLE_STANDARD_ARGS(soxr DEFAULT_MSG SOXR_LIBRARY SOXR_INCLUDE_DIR) |
| 44 | + |
| 45 | +if (SOXR_INCLUDE_DIR AND SOXR_LIBRARY) |
| 46 | + set(SOXR_FOUND TRUE) |
| 47 | + set(SOXR_LIBRARIES ${SOXR_LIBRARY}) |
| 48 | +endif (SOXR_INCLUDE_DIR AND SOXR_LIBRARY) |
| 49 | + |
| 50 | +if (SOXR_FOUND) |
| 51 | + if (NOT SOXR_FIND_QUIETLY) |
| 52 | + message(STATUS "Found soxr: ${SOXR_LIBRARIES}") |
| 53 | + endif (NOT SOXR_FIND_QUIETLY) |
| 54 | +else (SOXR_FOUND) |
| 55 | + if (SOXR_FIND_REQUIRED) |
| 56 | + message(FATAL_ERROR "soxr was not found") |
| 57 | + endif(SOXR_FIND_REQUIRED) |
| 58 | +endif (SOXR_FOUND) |
| 59 | + |
| 60 | +mark_as_advanced(SOXR_INCLUDE_DIR SOXR_LIBRARY) |
| 61 | + |
0 commit comments