mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 11:44:53 +08:00
- Find and use GTest as imported target GTest::GTest
- Note:
- GTest::GTest is available from CMake 3.5 and depricated in 3.20 but
still available in latest version.
- GTest::gtest added in CMake 3.20
Signed-off-by: Alex Moriarty <alex.moriarty@picknik.ai>
19 lines
773 B
CMake
19 lines
773 B
CMake
if(UNIX)
|
|
find_package(GTest REQUIRED)
|
|
|
|
add_executable(${PROJECT_NAME}-test unix_serial_tests.cc)
|
|
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME} GTest::GTest)
|
|
if(NOT APPLE)
|
|
target_link_libraries(${PROJECT_NAME}-test util)
|
|
endif()
|
|
add_test("${PROJECT_NAME}-test-gtest" ${PROJECT_NAME}-test)
|
|
|
|
if(NOT APPLE) # these tests are unreliable on macOS
|
|
add_executable(${PROJECT_NAME}-test-timer unit/unix_timer_tests.cc)
|
|
target_link_libraries(${PROJECT_NAME}-test-timer ${PROJECT_NAME} GTest::GTest)
|
|
add_test("${PROJECT_NAME}-test-timer-gtest" ${PROJECT_NAME}-test-timer)
|
|
endif()
|
|
# Boost is only required for tests/proof_of_concepts which are not enabled by default
|
|
# find_package(Boost REQUIRED)
|
|
endif()
|