The open source OpenXR runtime
at main 68 lines 1.8 kB view raw
1# Copyright 2022, Collabora, Ltd. 2# 3# SPDX-License-Identifier: BSL-1.0 4# 5# Distributed under the Boost Software License, Version 1.0. 6# (See accompanying file LICENSE_1_0.txt or copy at 7# http://www.boost.org/LICENSE_1_0.txt) 8# 9# Original Author: 10# 2022 Daniel Willmott <web@dan-w.com> 11 12#.rst: 13# Findbluetooth 14# --------------- 15# 16# Find the bluetooth library 17# 18# Targets 19# ^^^^^^^ 20# 21# If successful, the following import target is created. 22# 23# ``bluetooth::bluetooth`` 24# 25# Cache variables 26# ^^^^^^^^^^^^^^^ 27# 28# The following cache variable may also be set to assist/control the operation of this module: 29# 30# ``BLUETOOTH_ROOT_DIR`` 31# The root to search for bluetooth 32 33set(bluetooth_ROOT_DIR 34 "${bluetooth_ROOT_DIR}" 35 CACHE 36 PATH 37 "Directory to search for the BlueZ bluetooth library") 38 39find_package(PkgConfig) 40pkg_check_modules(PC_BLUETOOTH QUIET bluetooth bluez) 41 42find_path(bluetooth_INCLUDE_DIR 43 NAMES bluetooth/bluetooth.h 44 PATHS ${bluetooth_ROOT_DIR} 45 HINTS ${PC_BLUETOOTH_INCLUDE_DIRS}) 46find_library( 47 bluetooth_LIBRARY 48 NAMES bluetooth libbluetooth 49 PATHS ${bluetooth_ROOT_DIR} 50 HINTS ${PC_BLUETOOTH_LIBDIR}) 51 52 53include(FindPackageHandleStandardArgs) 54find_package_handle_standard_args(bluetooth 55 REQUIRED_VARS bluetooth_LIBRARY bluetooth_INCLUDE_DIR) 56 57if (bluetooth_FOUND) 58 set(bluetooth_INCLUDE_DIRS ${bluetooth_INCLUDE_DIR}) 59 set(bluetooth_LIBRARIES ${bluetooth_LIBRARY}) 60 61 if (NOT TARGET bluetooth::bluetooth) 62 add_library(bluetooth::bluetooth UNKNOWN IMPORTED) 63 set_target_properties(bluetooth::bluetooth PROPERTIES 64 IMPORTED_LOCATION "${bluetooth_LIBRARY}" 65 INTERFACE_INCLUDE_DIRECTORIES "${bluetooth_INCLUDE_DIR}") 66 endif () 67endif() 68mark_as_advanced(bluetooth_INCLUDE_DIR bluetooth_LIBRARY)