x-tools/cmake/x_qt_bluetooth.cmake
2025-08-01 14:02:50 +08:00

14 lines
556 B
CMake

find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Bluetooth)
if(Qt${QT_VERSION_MAJOR}Bluetooth_FOUND AND QT_VERSION VERSION_GREATER_EQUAL "6.5.0")
add_compile_definitions(X_ENABLE_BLUETOOTH)
list(APPEND X_LIBS Qt${QT_VERSION_MAJOR}::Bluetooth)
else()
message(STATUS "Bluetooth module is disable, Bluetooth files will be removed.")
file(GLOB_RECURSE BLE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/ble*")
foreach(file ${BLE_FILES})
list(REMOVE_ITEM X_SOURCES ${file})
message(STATUS "[Bluetooth]Remove file: ${file}")
endforeach()
endif()