-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
executable file
·55 lines (43 loc) · 1.46 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Version check
cmake_minimum_required(VERSION 3.8)
add_subdirectory(dbus-glue)
add_subdirectory(dbus-glue-system)
if(NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING "" FORCE)
endif()
endif()
# Project
project(bluetooth_test)
# Add files
file(
GLOB
sources
"main.cpp"
"bluetooth/rfcomm_server.cpp"
"bluetooth/bluez/device.cpp"
"bluetooth/bluez/adapter.cpp"
"bluetooth/bluez/connection_manager.cpp"
"bluetooth/bluez/reactor.cpp")
# Add exec
add_executable(bluetooth_test ${sources})
include(FindPkgConfig)
pkg_check_modules(SYSTEMD "libsystemd")
find_library(LBLUETOOTH NAMES bluetooth)
message("Following paths for the libraries were found:")
message("\tbluetooth: " ${LBLUETOOTH})
target_link_libraries(bluetooth_test PRIVATE ${LBLUETOOTH} dbus-glue dbus-glue-system
${SYSTEMD_LIBRARIES} -lpthread)
# Compiler Options
set(DEBUG_OPTIONS -fexceptions -g -Wall -pedantic-errors -pedantic)
set(RELEASE_OPTIONS -fexceptions -O3 -Wall -pedantic-errors -pedantic)
target_compile_options(bluetooth_test
PRIVATE "$<$<CONFIG:DEBUG>:${DEBUG_OPTIONS}>")
target_compile_options(bluetooth_test
PRIVATE "$<$<CONFIG:RELEASE>:${RELEASE_OPTIONS}>")