2018-03-02 11:45:15 -08:00
|
|
|
# For now, Google Test is NOT required */
|
|
|
|
find_package(GTest)
|
|
|
|
|
|
|
|
# If not found, print a status message and return
|
|
|
|
if(NOT GTEST_FOUND)
|
|
|
|
message(STATUS "Install Google Test to enable additional unit testing")
|
|
|
|
return ()
|
|
|
|
endif()
|
|
|
|
|
2018-03-02 16:01:20 -08:00
|
|
|
# Unit tests - utilities library
|
2018-03-02 11:45:15 -08:00
|
|
|
add_executable(utilities_tests utilities/utilities_tests.cxx)
|
|
|
|
target_link_libraries(utilities_tests utilities GTest::GTest GTest::Main)
|
|
|
|
gtest_add_tests(utilities_tests "" AUTO)
|
2018-03-02 16:01:20 -08:00
|
|
|
|
|
|
|
# Unit tests - Json header
|
|
|
|
add_executable(json_tests json/json_tests.cxx)
|
|
|
|
target_link_libraries(json_tests GTest::GTest GTest::Main)
|
|
|
|
target_include_directories(json_tests PRIVATE "${UPM_COMMON_HEADER_DIRS}/")
|
|
|
|
gtest_add_tests(json_tests "" AUTO)
|
2018-03-13 14:15:33 -07:00
|
|
|
|
2018-07-19 17:57:28 +03:00
|
|
|
# Unit tests - logger header library
|
|
|
|
add_executable(logger_tests logger/logger_tests.cxx)
|
|
|
|
target_link_libraries(logger_tests pthread GTest::GTest GTest::Main)
|
|
|
|
target_include_directories(logger_tests PRIVATE "${UPM_COMMON_HEADER_DIRS}/")
|
|
|
|
gtest_add_tests(logger_tests "" AUTO)
|
|
|
|
|
2018-05-21 07:35:48 -07:00
|
|
|
# Unit tests - nmea_gps library
|
|
|
|
add_executable(nmea_gps_tests nmea_gps/nmea_gps_tests.cxx)
|
|
|
|
target_link_libraries(nmea_gps_tests nmea_gps GTest::GTest GTest::Main)
|
|
|
|
gtest_add_tests(nmea_gps_tests "" AUTO)
|
|
|
|
|
2018-03-13 14:15:33 -07:00
|
|
|
# Add a custom target for unit tests
|
|
|
|
add_custom_target(tests-unit ALL
|
|
|
|
DEPENDS
|
|
|
|
utilities_tests
|
|
|
|
json_tests
|
2018-07-19 17:57:28 +03:00
|
|
|
logger_tests
|
2018-03-13 14:15:33 -07:00
|
|
|
COMMENT "UPM unit test collection")
|
|
|
|
|