list(APPEND SOURCE_FILES Bluetooth.cpp) list(APPEND SOURCE_FILES BluetoothImpl.h) list(APPEND SOURCE_FILES ByteBuffer.cpp) list(APPEND SOURCE_FILES log.h) list(APPEND SOURCE_FILES "${PROJECT_SOURCE_DIR}/include/ble/Bluetooth.h") list(APPEND SOURCE_FILES "${PROJECT_SOURCE_DIR}/include/ble/ByteBuffer.h") if(IS_LINUX) list(APPEND SOURCE_FILES LinuxBluetooth.cpp LinuxBluetooth.h) list(APPEND COMPILE_OPTIONS -DIS_LINUX) elseif(IS_APPLE) list(APPEND SOURCE_FILES OsxBluetooth.mm OsxBluetooth.h OsxBluetoothImpl.h) list(APPEND COMPILE_OPTIONS -DIS_APPLE) find_library(CORE_BLUETOOTH_LIBRARY CoreBluetooth) if (NOT CORE_BLUETOOTH_LIBRARY) message(FATAL_ERROR "CoreBluetooth not found") endif() message(STATUS "CORE_BLUETOOTH_LIBRARY=${CORE_BLUETOOTH_LIBRARY}") # list(APPEND INCLUDE_DIRECTORIES ${CORE_BLUETOOTH_LIBRARY}/Headers) # list(APPEND LIBRARIES_LIST ${CORE_BLUETOOTH_LIBRARY}/CoreBluetooth) list(APPEND LIBRARIES_LIST ${CORE_BLUETOOTH_LIBRARY}) find_library(IOBLUETOOTH_LIBRARY IOBluetooth) if (NOT IOBLUETOOTH_LIBRARY) message(FATAL_ERROR "IOBluetooth not found") endif() message(STATUS "IOBLUETOOTH_LIBRARY=${IOBLUETOOTH_LIBRARY}") # list(APPEND INCLUDE_DIRECTORIES ${IOBLUETOOTH_LIBRARY}/Headers) # list(APPEND LIBRARIES_LIST ${IOBLUETOOTH_LIBRARY}/IOBluetooth) list(APPEND LIBRARIES_LIST ${IOBLUETOOTH_LIBRARY}) find_library(FOUNDATION_LIBRARY Foundation) if (NOT FOUNDATION_LIBRARY) message(FATAL_ERROR "Foundation not found") endif() message(STATUS "FOUNDATION_LIBRARY=${FOUNDATION_LIBRARY}") # list(APPEND INCLUDE_DIRECTORIES ${FOUNDATION_LIBRARY}/Headers) # list(APPEND LIBRARIES_LIST ${FOUNDATION_LIBRARY}/Foundation) list(APPEND LIBRARIES_LIST ${FOUNDATION_LIBRARY}) endif() list(APPEND INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/include") find_package(Boost COMPONENTS regex system program_options REQUIRED) list(APPEND INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") add_library(ble ${SOURCE_FILES}) target_include_directories(ble PUBLIC "${Boost_INCLUDE_DIRS}" ${INCLUDE_DIRECTORIES}) target_compile_options(ble PRIVATE -Wno-deprecated-register ${COMPILE_OPTIONS}) target_link_libraries(ble PUBLIC ${LIBRARIES_LIST})