| 1 |
# - Try to find Speex |
| 2 |
# Once done this will define |
| 3 |
# |
| 4 |
# SPEEX_FOUND - system has Speex |
| 5 |
# SPEEX_INCLUDE_DIRS - the Speex include directory |
| 6 |
# SPEEX_LIBRARIES - Link these to use Speex |
| 7 |
# SPEEX_DEFINITIONS - Compiler switches required for using Speex |
| 8 |
# |
| 9 |
# Copyright (c) 2006 Andreas Schneider <[email protected]> |
| 10 |
# |
| 11 |
# Redistribution and use is allowed according to the terms of the New |
| 12 |
# BSD license. |
| 13 |
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
| 14 |
# |
| 15 |
|
| 16 |
|
| 17 |
if (SPEEX_LIBRARIES AND SPEEX_INCLUDE_DIRS) |
| 18 |
# in cache already |
| 19 |
set(SPEEX_FOUND TRUE) |
| 20 |
else (SPEEX_LIBRARIES AND SPEEX_INCLUDE_DIRS) |
| 21 |
# use pkg-config to get the directories and then use these values |
| 22 |
# in the FIND_PATH() and FIND_LIBRARY() calls |
| 23 |
#include(UsePkgConfig) |
| 24 |
|
| 25 |
#FIXME pkgconfig does not work: return a carriage return that makes compilation failed |
| 26 |
#pkgconfig(speex _SpeexIncDir _SpeexLinkDir _SpeexLinkFlags _SpeexCflags) |
| 27 |
|
| 28 |
#set(SPEEX_DEFINITIONS ${_SpeexCflags}) |
| 29 |
set(SPEEX_DEFINITIONS "") |
| 30 |
|
| 31 |
find_path(SPEEX_INCLUDE_DIR |
| 32 |
NAMES |
| 33 |
speex/speex.h |
| 34 |
speex.h |
| 35 |
PATHS |
| 36 |
${_SpeexIncDir} |
| 37 |
/usr/include |
| 38 |
/usr/local/include |
| 39 |
/opt/local/include |
| 40 |
/sw/include |
| 41 |
) |
| 42 |
|
| 43 |
find_library(SPEEX_LIBRARY |
| 44 |
NAMES |
| 45 |
speex |
| 46 |
Speex |
| 47 |
PATHS |
| 48 |
${_SpeexLinkDir} |
| 49 |
/usr/lib |
| 50 |
/usr/local/lib |
| 51 |
/opt/local/lib |
| 52 |
/sw/lib |
| 53 |
) |
| 54 |
|
| 55 |
if (SPEEX_LIBRARY) |
| 56 |
set(SPEEX_FOUND TRUE) |
| 57 |
endif (SPEEX_LIBRARY) |
| 58 |
|
| 59 |
set(SPEEX_INCLUDE_DIRS |
| 60 |
${SPEEX_INCLUDE_DIR} |
| 61 |
) |
| 62 |
|
| 63 |
if (SPEEX_FOUND) |
| 64 |
set(SPEEX_LIBRARIES |
| 65 |
${SPEEX_LIBRARIES} |
| 66 |
${SPEEX_LIBRARY} |
| 67 |
) |
| 68 |
endif (SPEEX_FOUND) |
| 69 |
|
| 70 |
if (SPEEX_INCLUDE_DIRS AND SPEEX_LIBRARIES) |
| 71 |
set(SPEEX_FOUND TRUE) |
| 72 |
endif (SPEEX_INCLUDE_DIRS AND SPEEX_LIBRARIES) |
| 73 |
|
| 74 |
if (SPEEX_FOUND) |
| 75 |
if (NOT Speex_FIND_QUIETLY) |
| 76 |
message(STATUS "Found Speex: ${SPEEX_LIBRARIES}") |
| 77 |
endif (NOT Speex_FIND_QUIETLY) |
| 78 |
else (SPEEX_FOUND) |
| 79 |
if (Speex_FIND_REQUIRED) |
| 80 |
message(FATAL_ERROR "Could not find Speex") |
| 81 |
endif (Speex_FIND_REQUIRED) |
| 82 |
endif (SPEEX_FOUND) |
| 83 |
|
| 84 |
# show the SPEEX_INCLUDE_DIRS and SPEEX_LIBRARIES variables only in the advanced view |
| 85 |
mark_as_advanced(SPEEX_INCLUDE_DIRS SPEEX_LIBRARIES) |
| 86 |
|
| 87 |
endif (SPEEX_LIBRARIES AND SPEEX_INCLUDE_DIRS) |