summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVo Trung Chi <chi.votrung@vn.bosch.com>2019-07-03 09:41:38 +0700
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2019-07-03 11:41:38 +0900
commitb757183f51920e8445ed0ea0bbdb490d99781ec6 (patch)
treeab984058504593f58a842f79b945dd6c6f12751f /tests
parentc232148a950c536b99bf91033a78ada6ee6f1771 (diff)
downloadDLT-daemon-b757183f51920e8445ed0ea0bbdb490d99781ec6.tar.gz
cmake-improvements (#135)
1. Allow building as a subproject of another cmake project (CMAKE_* vs PROJECT_* variables) 2. Do not generate header files within source – bad practice, use build directory for that(e.g. change location where dlt_version.h is being generated) 3. Use add_compile_options() instead of *_C/CXX_FLAGS variables for proper compile environment definition, also bad practice, also see p.2 4. Add WITH_DLT_PKGCONFIG – add generate pkgconfig .pc files as switchable option, should probably be part of headers install routine. Signed-off-by: Radoslaw Kaczorowski <external.radoslaw.kaczorowski@bosch-softtec.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt14
1 files changed, 4 insertions, 10 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c56bb22..609a7a0 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,15 +1,10 @@
# Setup testing
enable_testing()
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${gtest_SOURCE_DIR}/include")
+#add_compile_options(-g -fsanitize=address)
+add_compile_options(-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)
+configure_file(${PROJECT_SOURCE_DIR}/tests/testfile.dlt ${PROJECT_BINARY_DIR}/tests COPYONLY)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LIBRARIES gtest gtest_main)
@@ -43,8 +38,7 @@ 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})
+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()