File: Findhamlib.cmake

package info (click to toggle)
cubicsdr 0.2.7%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,560 kB
  • sloc: cpp: 32,850; sh: 60; makefile: 6
file content (77 lines) | stat: -rw-r--r-- 1,991 bytes parent folder | download | duplicates (5)
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
# - Try to find Hamlib
# Author: George L. Emigh - AB4BD
# 
# Change Log: Charles J. Cliffe <cj@cubicproductions.com>
#  Updates: 
#       Jan 2015 - Add /opt/ paths for OSX MacPorts
#                - Fix HAMLIB_INCLUDE_DIR absolute search
#                - Add static lib support
#  TODO: 
#       Windows support
#
# HAMLIB_FOUND - system has Hamlib
# HAMLIB_LIBRARY - location of the library for hamlib
# HAMLIB_INCLUDE_DIR - location of the include files for hamlib

set(HAMLIB_FOUND FALSE)

find_path(HAMLIB_INCLUDE_DIR
	NAMES hamlib/rig.h
	PATHS
		/usr/include
		/usr/local/include
		/opt/local/include
)

find_library(HAMLIB_LIBRARY
	NAMES hamlib
	PATHS
		/usr/lib64/hamlib
		/usr/lib/hamlib
		/usr/lib64
		/usr/lib
		/usr/local/lib64/hamlib
		/usr/local/lib/hamlib
		/usr/local/lib64
		/usr/local/lib
		/opt/local/lib
		/opt/local/lib/hamlib
)

find_library(HAMLIB_STATIC_LIBRARY
	NAMES libhamlib.a
	PATHS
		/usr/lib64/hamlib
		/usr/lib/hamlib
		/usr/lib64
		/usr/lib
		/usr/local/lib64/hamlib
		/usr/local/lib/hamlib
		/usr/local/lib64
		/usr/local/lib
		/opt/local/lib
		/opt/local/lib/hamlib
)

GET_FILENAME_COMPONENT(HAMLIB_LIB_FOLDER ${HAMLIB_STATIC_LIBRARY} DIRECTORY)

file(GLOB HAMLIB_STATIC_MODS ${HAMLIB_LIB_FOLDER}/hamlib-*.a)

if(HAMLIB_INCLUDE_DIR AND HAMLIB_LIBRARY)
	set(HAMLIB_FOUND TRUE)
    # message(STATUS "Hamlib version: ${VERSION}")
	message(STATUS "Found hamlib library at: ${HAMLIB_LIBRARY}")
	message(STATUS "Found hamlib static library at: ${HAMLIB_STATIC_LIBRARY}")
	message(STATUS "Found hamlib static modules: ${HAMLIB_STATIC_MODS}")
	message(STATUS "Found hamlib include directory at: ${HAMLIB_INCLUDE_DIR}")
endif(HAMLIB_INCLUDE_DIR AND HAMLIB_LIBRARY)

IF(NOT HAMLIB_FOUND)
  IF(NOT HAMLIB_FIND_QUIETLY)
    MESSAGE(STATUS "HAMLIB was not found.")
  ELSE(NOT HAMLIB_FIND_QUIETLY)
    IF(HAMLIB_FIND_REQUIRED)
      MESSAGE(FATAL_ERROR "HAMLIB was not found.")
    ENDIF(HAMLIB_FIND_REQUIRED)
  ENDIF(NOT HAMLIB_FIND_QUIETLY)
ENDIF(NOT HAMLIB_FOUND)