File: FindSpeex.cmake

package info (click to toggle)
flightgear 1%3A2016.4.4%2Bdfsg-3%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 48,512 kB
  • ctags: 71,727
  • sloc: cpp: 195,395; ansic: 177,152; sh: 13,661; perl: 4,475; python: 2,381; asm: 642; makefile: 398; java: 314; xml: 85
file content (87 lines) | stat: -rw-r--r-- 2,210 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# - Try to find Speex
# Once done this will define
#
#  SPEEX_FOUND - system has Speex
#  SPEEX_INCLUDE_DIRS - the Speex include directory
#  SPEEX_LIBRARIES - Link these to use Speex
#  SPEEX_DEFINITIONS - Compiler switches required for using Speex
#
#  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
#  Redistribution and use is allowed according to the terms of the New
#  BSD license.
#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


if (SPEEX_LIBRARIES AND SPEEX_INCLUDE_DIRS)
  # in cache already
  set(SPEEX_FOUND TRUE)
else (SPEEX_LIBRARIES AND SPEEX_INCLUDE_DIRS)
  # use pkg-config to get the directories and then use these values
  # in the FIND_PATH() and FIND_LIBRARY() calls
  #include(UsePkgConfig)

  #FIXME pkgconfig does not work: return a carriage return that makes compilation failed
  #pkgconfig(speex _SpeexIncDir _SpeexLinkDir _SpeexLinkFlags _SpeexCflags)

  #set(SPEEX_DEFINITIONS ${_SpeexCflags})
  set(SPEEX_DEFINITIONS "")

  find_path(SPEEX_INCLUDE_DIR
    NAMES
      speex/speex.h
      speex.h
    PATHS
      ${_SpeexIncDir}
      /usr/include
      /usr/local/include
      /opt/local/include
      /sw/include
  )

  find_library(SPEEX_LIBRARY
    NAMES
      speex
      Speex
    PATHS
      ${_SpeexLinkDir}
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )

  if (SPEEX_LIBRARY)
    set(SPEEX_FOUND TRUE)
  endif (SPEEX_LIBRARY)

  set(SPEEX_INCLUDE_DIRS
    ${SPEEX_INCLUDE_DIR}
  )

  if (SPEEX_FOUND)
    set(SPEEX_LIBRARIES
      ${SPEEX_LIBRARIES}
      ${SPEEX_LIBRARY}
    )
  endif (SPEEX_FOUND)

  if (SPEEX_INCLUDE_DIRS AND SPEEX_LIBRARIES)
    set(SPEEX_FOUND TRUE)
  endif (SPEEX_INCLUDE_DIRS AND SPEEX_LIBRARIES)

  if (SPEEX_FOUND)
    if (NOT Speex_FIND_QUIETLY)
      message(STATUS "Found Speex: ${SPEEX_LIBRARIES}")
    endif (NOT Speex_FIND_QUIETLY)
  else (SPEEX_FOUND)
    if (Speex_FIND_REQUIRED)
      message(FATAL_ERROR "Could not find Speex")
    endif (Speex_FIND_REQUIRED)
  endif (SPEEX_FOUND)

  # show the SPEEX_INCLUDE_DIRS and SPEEX_LIBRARIES variables only in the advanced view
  mark_as_advanced(SPEEX_INCLUDE_DIRS SPEEX_LIBRARIES)

endif (SPEEX_LIBRARIES AND SPEEX_INCLUDE_DIRS)