Skip to content

Commit

Permalink
Enable tests
Browse files Browse the repository at this point in the history
Signed-off-by: Zachary Michaels <[email protected]>
  • Loading branch information
zmichaels11 committed Nov 18, 2019
1 parent 288e994 commit 39cee03
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
29 changes: 29 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,43 @@ target_include_directories(${PROJECT_NAME}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

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()
3 changes: 1 addition & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>ament_cmake_gmock</test_depend>
<test_depend>boost</test_depend>

<export>
Expand Down

0 comments on commit 39cee03

Please sign in to comment.