]> git.mxchange.org Git - flightgear.git/blob - CMakeModules/FindGsm.cmake
initial commit for a python based terrasync client
[flightgear.git] / CMakeModules / FindGsm.cmake
1 # - Try to find GSM
2 # Once done this will define
3 #
4 #  GSM_FOUND - system has GSM
5 #  GSM_INCLUDE_DIRS - the GSM include directory
6 #  GSM_LIBRARIES - Link these to use GSM
7 #  GSM_DEFINITIONS - Compiler switches required for using GSM
8 #
9 #  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
10 #  Edited by Saikrishna Arcot <saiarcot895@gmail.com> to find the GSM 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 (GSM_LIBRARIES AND GSM_INCLUDE_DIRS)
19   # in cache already
20   set(GSM_FOUND TRUE)
21 else (GSM_LIBRARIES AND GSM_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(speex _GsmIncDir _GsmLinkDir _GsmLinkFlags _GsmCflags)
28
29   #set(GSM_DEFINITIONS ${_GsmCflags})
30   set(GSM_DEFINITIONS "")
31
32   find_path(GSM_INCLUDE_DIR
33     NAMES
34       gsm/gsm.h
35       gsm.h
36     PATHS
37       ${_GsmIncDir}
38       /usr/include
39       /usr/local/include
40       /opt/local/include
41       /sw/include
42   )
43
44   find_library(GSM_LIBRARY
45     NAMES
46       gsm
47       Gsm
48     PATHS
49       ${_GsmLinkDir}
50       /usr/lib
51       /usr/local/lib
52       /opt/local/lib
53       /sw/lib
54   )
55
56   if (GSM_LIBRARY)
57     set(GSM_FOUND TRUE)
58   endif (GSM_LIBRARY)
59
60   set(GSM_INCLUDE_DIRS
61     ${GSM_INCLUDE_DIR}
62   )
63
64   if (GSM_FOUND)
65     set(GSM_LIBRARIES
66       ${GSM_LIBRARIES}
67       ${GSM_LIBRARY}
68     )
69   endif (GSM_FOUND)
70
71   if (GSM_INCLUDE_DIRS AND GSM_LIBRARIES)
72     set(GSM_FOUND TRUE)
73   endif (GSM_INCLUDE_DIRS AND GSM_LIBRARIES)
74
75   if (GSM_FOUND)
76     if (NOT Gsm_FIND_QUIETLY)
77       message(STATUS "Found GSM: ${GSM_LIBRARIES}")
78     endif (NOT Gsm_FIND_QUIETLY)
79   else (GSM_FOUND)
80     if (Gsm_FIND_REQUIRED)
81       message(FATAL_ERROR "Could not find GSM")
82     endif (Gsm_FIND_REQUIRED)
83   endif (GSM_FOUND)
84
85   # show the GSM_INCLUDE_DIRS and GSM_LIBRARIES variables only in the advanced view
86   mark_as_advanced(GSM_INCLUDE_DIRS GSM_LIBRARIES)
87
88 endif (GSM_LIBRARIES AND GSM_INCLUDE_DIRS)