]> git.mxchange.org Git - flightgear.git/blob - CMakeModules/FindSpeexdsp.cmake
Launcher GUI for in-air / navaid starts
[flightgear.git] / CMakeModules / FindSpeexdsp.cmake
1 # - Try to find Speex extended library
2 # Once done this will define
3 #
4 #  SPEEXDSP_FOUND - system has Speex extended library
5 #  SPEEXDSP_INCLUDE_DIRS - the Speex extended library include directory
6 #  SPEEXDSP_LIBRARIES - Link these to use Speex extended library
7 #  SPEEXDSP_DEFINITIONS - Compiler switches required for using Speex extended library
8 #
9 #  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
10 #  Edited by Saikrishna Arcot <saiarcot895@gmail.com> to find the Speex extended library
11 #
12 #  Redistribution and use is allowed according to the terms of the New
13 #  BSD license.
14 #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15 #
16
17
18 if (SPEEXDSP_LIBRARIES AND SPEEXDSP_INCLUDE_DIRS)
19   # in cache already
20   set(SPEEXDSP_FOUND TRUE)
21 else (SPEEXDSP_LIBRARIES AND SPEEXDSP_INCLUDE_DIRS)
22   # use pkg-config to get the directories and then use these values
23   # in the FIND_PATH() and FIND_LIBRARY() calls
24   #include(UsePkgConfig)
25
26   #FIXME pkgconfig does not work: return a carriage return that makes compilation failed
27   #pkgconfig(speexdsp _SpeexDspIncDir _SpeexDspLinkDir _SpeexDspLinkFlags _SpeexDspCflags)
28
29   #set(SPEEXDSP_DEFINITIONS ${_SpeexDspCflags})
30   set(SPEEXDSP_DEFINITIONS "")
31
32   find_path(SPEEXDSP_INCLUDE_DIR
33     NAMES
34       speex/speex_preprocess.h
35       speex_preprocess.h
36     PATHS
37       ${_SpeexDspIncDir}
38       /usr/include
39       /usr/local/include
40       /opt/local/include
41       /sw/include
42   )
43
44   find_library(SPEEXDSP_LIBRARY
45     NAMES
46       speexdsp
47       Speexdsp
48     PATHS
49       ${_SpeexDspLinkDir}
50       /usr/lib
51       /usr/local/lib
52       /opt/local/lib
53       /sw/lib
54   )
55
56   if (SPEEXDSP_LIBRARY)
57     set(SPEEXDSP_FOUND TRUE)
58   endif (SPEEXDSP_LIBRARY)
59
60   set(SPEEXDSP_INCLUDE_DIRS
61     ${SPEEXDSP_INCLUDE_DIR}
62   )
63
64   if (SPEEXDSP_FOUND)
65     set(SPEEXDSP_LIBRARIES
66       ${SPEEXDSP_LIBRARIES}
67       ${SPEEXDSP_LIBRARY}
68     )
69   endif (SPEEXDSP_FOUND)
70
71   if (SPEEXDSP_INCLUDE_DIRS AND SPEEXDSP_LIBRARIES)
72     set(SPEEXDSP_FOUND TRUE)
73   endif (SPEEXDSP_INCLUDE_DIRS AND SPEEXDSP_LIBRARIES)
74
75   if (SPEEXDSP_FOUND)
76     if (NOT Speexdsp_FIND_QUIETLY)
77       message(STATUS "Found Speex extended library: ${SPEEXDSP_LIBRARIES}")
78     endif (NOT Speexdsp_FIND_QUIETLY)
79   else (SPEEXDSP_FOUND)
80     if (Speexdsp_FIND_REQUIRED)
81       message(FATAL_ERROR "Could not find Speex extended library")
82     endif (Speexdsp_FIND_REQUIRED)
83   endif (SPEEXDSP_FOUND)
84
85   # show the SPEEXDSP_INCLUDE_DIRS and SPEEXDSP_LIBRARIES variables only in the advanced view
86   mark_as_advanced(SPEEXDSP_INCLUDE_DIRS SPEEXDSP_LIBRARIES)
87
88 endif (SPEEXDSP_LIBRARIES AND SPEEXDSP_INCLUDE_DIRS)