Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert package to a pure CMake package #285

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Depend on GTest via its imported targets
- 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>
  • Loading branch information
moriarty committed Jun 17, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit f60d49d91b0b58a2427a082e3e9ef08db8d8398d
5 changes: 2 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
if(UNIX)
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

add_executable(${PROJECT_NAME}-test unix_serial_tests.cc)
target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME} ${GTEST_LIBRARIES})
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_LIBRARIES})
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