xref: /btstack/test/gatt-service-client/CMakeLists.txt (revision 77bf845768a9c39a5561c69033c0112e62f08947)
1cmake_minimum_required (VERSION 3.5)
2project(gatt-client-test)
3
4# pkgconfig
5find_package(PkgConfig REQUIRED)
6
7# CppuTest
8pkg_check_modules(CPPUTEST REQUIRED CppuTest)
9include_directories(${CPPUTEST_INCLUDE_DIRS})
10link_directories(${CPPUTEST_LIBRARY_DIRS})
11link_libraries(${CPPUTEST_LIBRARIES})
12
13# set include paths
14include_directories(..)
15include_directories(../../src)
16include_directories(../mock)
17include_directories( ${CMAKE_CURRENT_BINARY_DIR})
18
19add_compile_options(--coverage)
20add_link_options(   --coverage)
21add_definitions(    -DCOVERAGE)
22add_definitions(    -DHAVE_ASSERT)
23
24# common files
25set(SOURCES
26	../../src/btstack_linked_list.c
27	../../src/btstack_util.c
28	../../src/hci_dump.c
29	../../src/ble/gatt-service/ancs_client.c
30	../../src/ble/gatt-service/battery_service_client.c
31	../../src/ble/gatt-service/device_information_service_client.c
32	../mock/mock_gatt_client.c
33)
34
35# create static lib
36add_library(btstack STATIC ${SOURCES})
37
38# create targets
39file(GLOB TEST_FILES_C "*_test.cpp")
40foreach(TEST_FILE ${TEST_FILES_C})
41	# Use C++ Compiler
42	set (SOURCE_FILES ${TEST_FILE})
43	get_filename_component(TEST_NAME ${TEST_FILE} NAME_WE)
44	add_executable(${TEST_NAME} ${SOURCE_FILES} )
45	target_link_libraries(${TEST_NAME} btstack)
46endforeach(TEST_FILE)
47