summaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
blob: 50cca4fc0a4df6b4aa3e1b2a6fbf7d4fc4742240 (plain)
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
# Setup testing
enable_testing()

SET(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -isystem ${gtest_SOURCE_DIR}/include")

#SET(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -g")
#SET(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -fsanitize=address")

SET(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -std=gnu++0x")

configure_file(${CMAKE_SOURCE_DIR}/tests/testfile.dlt ${PROJECT_BINARY_DIR}/tests COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/tests/testfilter.txt ${PROJECT_BINARY_DIR}/tests COPYONLY)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
    set(LIBRARIES gtest gtest_main)
else()
    set(LIBRARIES gtest socket)
endif()

set(DLT_LIBRARIES ${LIBRARIES} dlt)
set(DLT_DAEMON_LIBRARIES ${LIBRARIES} dlt_daemon)

add_executable(gtest_dlt_common gtest_dlt_common.cpp)
add_executable(gtest_dlt_user gtest_dlt_user.cpp)
add_executable(gtest_dlt_daemon_common gtest_dlt_daemon_common.cpp ../src/daemon/dlt_daemon_common.c)
add_executable(dlt_test_receiver dlt_test_receiver.c)
add_executable(dlt_env_ll_unit_test dlt_env_ll_unit_test.cpp)
add_executable(dlt-test-preregister-context dlt-test-preregister-context.c)
add_executable(gtest_dlt_daemon_gateway gtest_dlt_daemon_gateway.cpp)
add_executable(gtest_dlt_daemon_event_handler gtest_dlt_daemon_event_handler.cpp)
add_executable(gtest_dlt_daemon_offline_log gtest_dlt_daemon_offline_log.cpp)
target_link_libraries(gtest_dlt_common ${DLT_LIBRARIES})
target_link_libraries(gtest_dlt_user ${DLT_LIBRARIES})
target_link_libraries(gtest_dlt_daemon_common ${DLT_LIBRARIES})
target_link_libraries(dlt_test_receiver dlt)
target_link_libraries(dlt_env_ll_unit_test ${DLT_LIBRARIES})
target_link_libraries(dlt-test-preregister-context ${DLT_LIBRARIES})
target_link_libraries(gtest_dlt_daemon_gateway ${DLT_DAEMON_LIBRARIES})
target_link_libraries(gtest_dlt_daemon_event_handler ${DLT_DAEMON_LIBRARIES})
target_link_libraries(gtest_dlt_daemon_offline_log ${DLT_DAEMON_LIBRARIES})

if(${WITH_DLT_CXX11_EXT})
  add_executable(dlt-test-cpp-extension dlt-test-cpp-extension.cpp)
  set_target_properties(dlt-test-cpp-extension PROPERTIES COMPILE_FLAGS "-std=gnu++0x")
  target_link_libraries(dlt-test-cpp-extension ${DLT_LIBRARIES})
endif()