diff options
Diffstat (limited to 'cmake/modules/FindBluetooth.cmake')
-rw-r--r-- | cmake/modules/FindBluetooth.cmake | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/cmake/modules/FindBluetooth.cmake b/cmake/modules/FindBluetooth.cmake index 70da7b1a4f..024c51e63b 100644 --- a/cmake/modules/FindBluetooth.cmake +++ b/cmake/modules/FindBluetooth.cmake @@ -5,20 +5,18 @@ # # This will define the following target: # -# Bluetooth::Bluetooth - The Bluetooth library +# ${APP_NAME_LC}::Bluetooth - The Bluetooth library -if(NOT TARGET Bluetooth::Bluetooth) +if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME}) find_package(PkgConfig) if(PKG_CONFIG_FOUND) pkg_check_modules(PC_BLUETOOTH bluez bluetooth QUIET) endif() find_path(BLUETOOTH_INCLUDE_DIR NAMES bluetooth/bluetooth.h - HINTS ${PC_BLUETOOTH_INCLUDEDIR} - NO_CACHE) + HINTS ${PC_BLUETOOTH_INCLUDEDIR}) find_library(BLUETOOTH_LIBRARY NAMES bluetooth libbluetooth - HINTS ${PC_BLUETOOTH_LIBDIR} - NO_CACHE) + HINTS ${PC_BLUETOOTH_LIBDIR}) set(BLUETOOTH_VERSION ${PC_BLUETOOTH_VERSION}) @@ -28,11 +26,10 @@ if(NOT TARGET Bluetooth::Bluetooth) VERSION_VAR BLUETOOTH_VERSION) if(BLUETOOTH_FOUND) - add_library(Bluetooth::Bluetooth UNKNOWN IMPORTED) - set_target_properties(Bluetooth::Bluetooth PROPERTIES - IMPORTED_LOCATION "${BLUETOOTH_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${BLUETOOTH_INCLUDE_DIR}" - INTERFACE_COMPILE_DEFINITIONS HAVE_LIBBLUETOOTH=1) - set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP Bluetooth::Bluetooth) + add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED) + set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES + IMPORTED_LOCATION "${BLUETOOTH_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${BLUETOOTH_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBBLUETOOTH) endif() endif() |