File: FindGPSD.cmake

package info (click to toggle)
obdgpslogger 0.16-1.3
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 5,160 kB
  • ctags: 7,498
  • sloc: ansic: 73,206; cpp: 2,055; php: 407; sh: 51; makefile: 4
file content (65 lines) | stat: -rw-r--r-- 1,503 bytes parent folder | download | duplicates (2)
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
SET(GPSD_FOUND "NO")

SET(CHUNKY_INSTALLED_GPSD_ON_HIS_MAC_IN $ENV{HOME}/gpsd/)

SET(GPSD_PREFIX "/usr/local/gpsd/" CACHE STRING
	"GPSD is installed in this prefix (if non-standard)")

SET(GPSD_SEARCH_PATHS
	${CHUNKY_INSTALLED_GPSD_ON_HIS_MAC_IN}/
	${GPSD_PREFIX}/
	/sw/
	/usr/
	/usr/local/
)

FIND_PATH(GPSD_INCLUDE_DIR
	NAMES gps.h
	PATH_SUFFIXES /include/
	PATHS ${GPSD_SEARCH_PATHS}
)

FIND_LIBRARY(GPSD_LIBRARY
	NAMES gps
	PATH_SUFFIXES /lib/
	PATHS ${GPSD_SEARCH_PATHS}
)

FIND_PROGRAM(GPSD_DAEMON
	NAMES gpsd
	PATH_SUFFIXES /sbin/ /bin/
	PATHS ${GPSD_SEARCH_PATHS}
)


IF(GPSD_LIBRARY AND GPSD_INCLUDE_DIR)
  SET(GPSD_FOUND "YES")
ENDIF(GPSD_LIBRARY AND GPSD_INCLUDE_DIR)

IF(GPSD_LIBRARY)
	INCLUDE(CheckFunctionExists)

	IF(NOT GPSD_FORCE_V2)
		SET(CMAKE_REQUIRED_LIBRARIES ${GPSD_LIBRARY})
		CHECK_FUNCTION_EXISTS(gps_stream HAVE_GPSD_V3)
		IF(HAVE_GPSD_V3)
			MESSAGE(STATUS "Found gps_stream method in GPSD - assuming version 3 API")
			ADD_DEFINITIONS(-DHAVE_GPSD_V3)
		ELSE(HAVE_GPSD_V3)
			MESSAGE(STATUS "Did not find gps_stream method in GPSD - assuming version 2 API")
		ENDIF(HAVE_GPSD_V3)
	ELSE(NOT GPSD_FORCE_V2)
		MESSAGE(STATUS "GPSD v2 API Forced")
	ENDIF(NOT GPSD_FORCE_V2)
ENDIF(GPSD_LIBRARY)

IF(GPSD_FOUND)
  IF(NOT GPSD_FIND_QUIETLY)
    MESSAGE(STATUS "Found GPSD: ${GPSD_LIBRARY},${GPSD_LIBRARY}")
  ENDIF(NOT GPSD_FIND_QUIETLY)
ELSE(GPSD_FOUND)
  IF(GPSD_FIND_REQUIRED)
    MESSAGE(FATAL_ERROR "Could not find GPSD Library")
  ENDIF(GPSD_FIND_REQUIRED)
ENDIF(GPSD_FOUND)