set (tinyb_LIB_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/api ${PROJECT_SOURCE_DIR}/api/tinyb ${PROJECT_SOURCE_DIR}/include ) include_directories( ${tinyb_LIB_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${GIO-UNIX_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) set (tinyb_LIB_SRCS ${PROJECT_SOURCE_DIR}/src/BluetoothObject.cpp ${PROJECT_SOURCE_DIR}/src/BluetoothEvent.cpp ${PROJECT_SOURCE_DIR}/src/BluetoothManager.cpp ${PROJECT_SOURCE_DIR}/src/BluetoothAdapter.cpp ${PROJECT_SOURCE_DIR}/src/BluetoothDevice.cpp ${PROJECT_SOURCE_DIR}/src/BluetoothGattService.cpp ${PROJECT_SOURCE_DIR}/src/BluetoothGattCharacteristic.cpp ${PROJECT_SOURCE_DIR}/src/BluetoothGattDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/BluetoothUUID.cpp ${PROJECT_SOURCE_DIR}/src/tinyb_utils.cpp # autogenerated files ${CMAKE_CURRENT_BINARY_DIR}/version.c ${CMAKE_CURRENT_BINARY_DIR}/orgbluez-dbus.c ) set (tinyb_LIB_GLOB_HEADERS ${PROJECT_SOURCE_DIR}/api/tinyb.hpp ) find_program(GDBUS_CODEGEN NAMES gdbus-codegen) if (NOT GDBUS_CODEGEN) message(FATAL_ERROR "gdbus-codegen not found") else () message(STATUS "gdbus-codegen found") endif () add_custom_command(OUTPUT orgbluez-dbus.c orgbluez-dbus.h COMMAND ${GDBUS_CODEGEN} --interface-prefix org.bluez --generate-c-code orgbluez-dbus --c-generate-object-manager ${PROJECT_SOURCE_DIR}/src/org.bluez.xml COMMENT "Generating dbus code from org.bluez.xml") add_library (tinyb SHARED ${tinyb_LIB_SRCS}) target_link_libraries ( tinyb ${CMAKE_THREAD_LIBS_INIT} ${GLIB2_LIBRARIES} ${GIO_LIBRARIES} ) set_target_properties( tinyb PROPERTIES SOVERSION ${tinyb_VERSION_MAJOR} VERSION ${tinyb_VERSION_STRING} CXX_STANDARD 11 ) install (FILES ${tinyb_LIB_GLOB_HEADERS} DESTINATION include/) install (DIRECTORY ${PROJECT_SOURCE_DIR}/api/tinyb/ DESTINATION include/tinyb) macro (tinyb_CREATE_INSTALL_PKGCONFIG generated_file install_location) configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location}) endmacro (tinyb_CREATE_INSTALL_PKGCONFIG) tinyb_create_install_pkgconfig (tinyb.pc lib${LIB_SUFFIX}/pkgconfig) install(TARGETS tinyb LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})