From 39cee03b6033ffa326dd8e17b7b556185be63610 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Mon, 18 Nov 2019 09:09:50 -0800 Subject: [PATCH] Enable tests Signed-off-by: Zachary Michaels --- CMakeLists.txt | 29 +++++++++++++++++++++++++++++ package.xml | 3 +-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 390b93a3..f6de602d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,14 +58,43 @@ target_include_directories(${PROJECT_NAME} $ $) +ament_target_dependencies(${PROJECT_NAME} + ament_index_cpp) + install( DIRECTORY include/ DESTINATION include) +install( + TARGETS ${PROJECT_NAME} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) + ament_export_include_directories(include) ament_export_libraries(${PROJECT_NAME}) if(BUILD_TESTING) + find_package(ament_cmake_gmock REQUIRED) + + if(UNIX) + ament_add_gmock(${PROJECT_NAME}-test + tests/unix_serial_tests.cc) + + if(TARGET ${PROJECT_NAME}-test) + target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME} ${Boost_LIBRARIES}) + + if(NOT APPLE) + target_link_libraries(${PROJECT_NAME}-test util) + endif() + endif() + endif() + + if(NOT APPLE) # these tests are unreliable on macOS + ament_add_gmock(${PROJECT_NAME}-test-timer + tests/unit/unix_timer_tests.cc) + target_link_libraries(${PROJECT_NAME}-test-timer ${PROJECT_NAME}) + endif() endif() ament_package() diff --git a/package.xml b/package.xml index 4e1946c0..07e5acea 100644 --- a/package.xml +++ b/package.xml @@ -21,8 +21,7 @@ ament_cmake - ament_lint_auto - ament_lint_common + ament_cmake_gmock boost