cmake: Move BlueZ detection to Core

This commit is contained in:
Florent Castelli
2017-02-08 00:29:34 +01:00
parent 277f813b72
commit 428d1624fa
3 changed files with 59 additions and 17 deletions

View File

@ -294,13 +294,26 @@ elseif(APPLE)
${IOB_LIBRARY})
elseif(UNIX)
set(SRCS ${SRCS} HW/EXI/BBA-TAP/TAP_Unix.cpp)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND BLUEZ_FOUND)
set(SRCS ${SRCS} HW/WiimoteReal/IOLinux.cpp)
set(LIBS ${LIBS} bluetooth)
elseif(ANDROID)
if(ANDROID)
set(SRCS ${SRCS} HW/WiimoteReal/IOAndroid.cpp)
endif()
endif()
# Bluez doesn't support all the communication modes on FreeBSD, so only using it on Linux
if(ENABLE_BLUEZ AND CMAKE_SYSTEM_NAME MATCHES "Linux")
find_package(BlueZ)
if(BLUEZ_FOUND)
message(STATUS "BlueZ found, enabling bluetooth support")
set(SRCS ${SRCS} HW/WiimoteReal/IOLinux.cpp)
set(LIBS ${LIBS} BlueZ::BlueZ)
add_definitions(-DHAVE_BLUEZ=1)
else()
message(STATUS "BlueZ NOT found, disabling bluetooth support")
endif()
else()
message(STATUS "BlueZ explicitly disabled, disabling bluetooth support")
endif()
if(HIDAPI_FOUND)
set(SRCS ${SRCS} HW/WiimoteReal/IOhidapi.cpp)
endif()