aboutsummaryrefslogtreecommitdiff
path: root/modules/FindBlueZ.cmake
blob: 8e1a2fc41c5f04d481b0b25c5648c17b50ab88b6 (plain)
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
# - Try to find BlueZ
# Once done this will define
#
#  BLUEZ_FOUND - system has BlueZ
#  BLUEZ_INCLUDE_DIR - the BlueZ include directory
#  BLUEZ_LIBRARIES - Link these to use BlueZ
#  BLUEZ_DEFINITIONS - Compiler switches required for using BlueZ
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


if ( BLUEZ_INCLUDE_DIR AND BLUEZ_LIBRARIES )
   # in cache already
   SET(BlueZ_FIND_QUIETLY TRUE)
endif ( BLUEZ_INCLUDE_DIR AND BLUEZ_LIBRARIES )

# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
if( NOT WIN32 )
  find_package(PkgConfig)

  pkg_check_modules(BLUEZ bluez)

  set(BLUEZ_DEFINITIONS ${BLUEZ_CFLAGS})
endif( NOT WIN32 )

FIND_PATH(BLUEZ_INCLUDE_DIR NAMES bluetooth/bluetooth.h
  PATHS
  ${BLUEZ_INCLUDE_DIRS}
  /usr/X11/include
)

FIND_LIBRARY(BLUEZ_LIBRARIES NAMES bluetooth
  PATHS
  ${BLUEZ_LIBRARY_DIRS}
)

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BlueZ DEFAULT_MSG BLUEZ_INCLUDE_DIR BLUEZ_LIBRARIES )

# show the BLUEZ_INCLUDE_DIR and BLUEZ_LIBRARIES variables only in the advanced view
MARK_AS_ADVANCED(BLUEZ_INCLUDE_DIR BLUEZ_LIBRARIES )