xref: /btstack/test/l2cap-cbm/CMakeLists.txt (revision c589a9bb896bd3ca6ce0b0556b913c50596ccdf8)
1af7c3ae6SMatthias Ringwaldcmake_minimum_required (VERSION 3.5)
2af7c3ae6SMatthias Ringwaldproject(gatt-client-test)
3af7c3ae6SMatthias Ringwald
4*c589a9bbSMatthias Ringwald# pkgconfig required to link cpputest
5*c589a9bbSMatthias Ringwaldfind_package(PkgConfig REQUIRED)
6*c589a9bbSMatthias Ringwald
7*c589a9bbSMatthias Ringwald# CppuTest
8*c589a9bbSMatthias Ringwaldpkg_check_modules(CPPUTEST REQUIRED CppuTest)
9*c589a9bbSMatthias Ringwaldinclude_directories(${CPPUTEST_INCLUDE_DIRS})
10*c589a9bbSMatthias Ringwaldlink_directories(${CPPUTEST_LIBRARY_DIRS})
11*c589a9bbSMatthias Ringwaldlink_libraries(${CPPUTEST_LIBRARIES})
12af7c3ae6SMatthias Ringwald
13af7c3ae6SMatthias Ringwald# set include paths
14af7c3ae6SMatthias Ringwaldinclude_directories(.)
15af7c3ae6SMatthias Ringwaldinclude_directories(../../src)
16af7c3ae6SMatthias Ringwaldinclude_directories(../mock)
17af7c3ae6SMatthias Ringwaldinclude_directories(../../platform/embedded)
18af7c3ae6SMatthias Ringwaldinclude_directories(../../platform/posix)
19af7c3ae6SMatthias Ringwaldinclude_directories( ${CMAKE_CURRENT_BINARY_DIR})
20af7c3ae6SMatthias Ringwald
21af7c3ae6SMatthias Ringwald# common files
22af7c3ae6SMatthias Ringwaldset(SOURCES
23af7c3ae6SMatthias Ringwald		../../src/btstack_linked_list.c
24af7c3ae6SMatthias Ringwald		../../src/btstack_util.c
25af7c3ae6SMatthias Ringwald		../../src/hci.c
26af7c3ae6SMatthias Ringwald		../../src/hci_cmd.c
27af7c3ae6SMatthias Ringwald		../../src/ad_parser.c
28af7c3ae6SMatthias Ringwald		../../src/l2cap.c
29af7c3ae6SMatthias Ringwald		../../src/l2cap_signaling.c
30af7c3ae6SMatthias Ringwald		../../src/btstack_memory.c
31af7c3ae6SMatthias Ringwald		../../src/btstack_run_loop.c
32af7c3ae6SMatthias Ringwald		../../src/hci_dump.c
33af7c3ae6SMatthias Ringwald		../../platform/posix/hci_dump_posix_stdout.c
34af7c3ae6SMatthias Ringwald		../../platform/embedded/btstack_run_loop_embedded.c
35af7c3ae6SMatthias Ringwald)
36af7c3ae6SMatthias Ringwald
37af7c3ae6SMatthias Ringwald# Enable ASAN
38af7c3ae6SMatthias Ringwaldadd_compile_options( -g -fsanitize=address)
39af7c3ae6SMatthias Ringwaldadd_link_options(       -fsanitize=address)
40af7c3ae6SMatthias Ringwald
41af7c3ae6SMatthias Ringwald# create static lib
42af7c3ae6SMatthias Ringwaldadd_library(btstack STATIC ${SOURCES})
43af7c3ae6SMatthias Ringwald
44af7c3ae6SMatthias Ringwald# create targets
45af7c3ae6SMatthias Ringwaldfile(GLOB TEST_FILES_CPP "*_test.cpp")
46af7c3ae6SMatthias Ringwaldforeach(TEST_FILE ${TEST_FILES_CPP})
47af7c3ae6SMatthias Ringwald	set (SOURCE_FILES ${TEST_FILE})
48af7c3ae6SMatthias Ringwald	get_filename_component(TEST_NAME ${TEST_FILE} NAME_WE)
49af7c3ae6SMatthias Ringwald	message("- " ${TEST_NAME})
50af7c3ae6SMatthias Ringwald	add_executable(${TEST_NAME} ${SOURCE_FILES} )
51af7c3ae6SMatthias Ringwald	target_link_libraries(${TEST_NAME} btstack)
52af7c3ae6SMatthias Ringwaldendforeach(TEST_FILE)
53