diff --git a/CMakeLists.txt b/CMakeLists.txt index bb6318e9..d1b209d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ if(NOT REVISION) endif(NOT REVISION) set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_INSTALL_PREFIX "/") include(GNUInstallDirs) include(CheckFunctionExists) @@ -102,6 +103,10 @@ add_definitions(-DHAVE_CONFIG_H -DSYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}" configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) +if(BUILD_TESTING) + enable_testing() +endif(BUILD_TESTING) + add_subdirectory(src/ebusd) add_subdirectory(src/lib/utils) add_subdirectory(src/lib/ebus) diff --git a/src/lib/ebus/CMakeLists.txt b/src/lib/ebus/CMakeLists.txt index 18d14ac8..bce533ff 100644 --- a/src/lib/ebus/CMakeLists.txt +++ b/src/lib/ebus/CMakeLists.txt @@ -21,3 +21,7 @@ if(HAVE_CONTRIB) endif(HAVE_CONTRIB) add_library(ebus ${libebus_a_SOURCES}) + +if(BUILD_TESTING) + add_subdirectory(test) +endif(BUILD_TESTING) diff --git a/src/lib/ebus/contrib/CMakeLists.txt b/src/lib/ebus/contrib/CMakeLists.txt index ac442716..f1ff1b85 100644 --- a/src/lib/ebus/contrib/CMakeLists.txt +++ b/src/lib/ebus/contrib/CMakeLists.txt @@ -10,3 +10,7 @@ set(libebuscontrib_a_SOURCES include_directories(..) add_library(ebuscontrib ${libebuscontrib_a_SOURCES}) + +if(BUILD_TESTING) + add_subdirectory(test) +endif(BUILD_TESTING) diff --git a/src/lib/ebus/contrib/test/CMakeLists.txt b/src/lib/ebus/contrib/test/CMakeLists.txt new file mode 100644 index 00000000..3341cfcc --- /dev/null +++ b/src/lib/ebus/contrib/test/CMakeLists.txt @@ -0,0 +1,7 @@ +include_directories(..) +include_directories(../..) +include_directories(../../../utils) + +add_executable(test_tem test_tem.cpp) +target_link_libraries(test_tem ebus ebuscontrib) +add_test(tem test_tem) diff --git a/src/lib/ebus/test/CMakeLists.txt b/src/lib/ebus/test/CMakeLists.txt new file mode 100644 index 00000000..5ad54d32 --- /dev/null +++ b/src/lib/ebus/test/CMakeLists.txt @@ -0,0 +1,26 @@ +if(HAVE_CONTRIB) + set(test_LIBS ${test_LIBS} ebuscontrib) +endif(HAVE_CONTRIB) + +include_directories(..) +include_directories(../../utils) + +add_executable(test_filereader test_filereader.cpp) +target_link_libraries(test_filereader ebus) +add_test(filereader test_filereader) + +add_executable(test_device test_device.cpp) +target_link_libraries(test_device ebus ${test_LIBS}) +add_test(device test_device) + +add_executable(test_symbol test_symbol.cpp) +target_link_libraries(test_symbol ebus) +add_test(symbol test_symbol) + +add_executable(test_data test_data.cpp) +target_link_libraries(test_data ebus ${test_LIBS}) +add_test(data test_data) + +add_executable(test_message test_message.cpp) +target_link_libraries(test_message ebus ${test_LIBS}) +add_test(message test_message)