@@ -123,10 +123,10 @@ function(test_target_function)
123123 )
124124
125125 rcl_add_custom_gtest (test_info_by_topic${target_suffix}
126- SRCS rcl/test_info_by_topic.cpp rcl/wait_for_entity_helpers.cpp
126+ SRCS rcl/test_info_by_topic.cpp
127127 ENV ${rmw_implementation_env_var}
128128 APPEND_LIBRARY_DIRS ${extra_lib_dirs}
129- LIBRARIES ${PROJECT_NAME}
129+ LIBRARIES ${PROJECT_NAME} wait_for_entity_helpers
130130 AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
131131 )
132132
@@ -213,27 +213,27 @@ function(test_target_function)
213213 )
214214
215215 rcl_add_custom_gtest (test_publisher_wait_all_ack${target_suffix}
216- SRCS rcl/test_publisher_wait_all_ack.cpp rcl/wait_for_entity_helpers.cpp
216+ SRCS rcl/test_publisher_wait_all_ack.cpp
217217 ENV ${rmw_implementation_env_var}
218218 APPEND_LIBRARY_DIRS ${extra_lib_dirs}
219219 INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} /../src/rcl/
220- LIBRARIES ${PROJECT_NAME} mimick
220+ LIBRARIES ${PROJECT_NAME} mimick wait_for_entity_helpers
221221 AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
222222 )
223223
224224 rcl_add_custom_gtest (test_service${target_suffix}
225- SRCS rcl/test_service.cpp rcl/wait_for_entity_helpers.cpp
225+ SRCS rcl/test_service.cpp
226226 ENV ${rmw_implementation_env_var}
227227 APPEND_LIBRARY_DIRS ${extra_lib_dirs}
228- LIBRARIES ${PROJECT_NAME} mimick
228+ LIBRARIES ${PROJECT_NAME} mimick wait_for_entity_helpers
229229 AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
230230 )
231231
232232 rcl_add_custom_gtest (test_subscription${target_suffix}
233- SRCS rcl/test_subscription.cpp rcl/wait_for_entity_helpers.cpp
233+ SRCS rcl/test_subscription.cpp
234234 ENV ${rmw_implementation_env_var}
235235 APPEND_LIBRARY_DIRS ${extra_lib_dirs}
236- LIBRARIES ${PROJECT_NAME} mimick
236+ LIBRARIES ${PROJECT_NAME} mimick wait_for_entity_helpers
237237 AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
238238 )
239239 # TODO(asorbini) Enable message timestamp tests for rmw_connextdds on Windows
@@ -311,14 +311,14 @@ function(test_target_function)
311311 # Launch tests
312312
313313 rcl_add_custom_executable (service_fixture${target_suffix}
314- SRCS rcl/service_fixture.cpp rcl/wait_for_entity_helpers.cpp
315- LIBRARIES ${PROJECT_NAME}
314+ SRCS rcl/service_fixture.cpp
315+ LIBRARIES ${PROJECT_NAME} wait_for_entity_helpers
316316 AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
317317 )
318318
319319 rcl_add_custom_executable (client_fixture${target_suffix}
320- SRCS rcl/client_fixture.cpp rcl/wait_for_entity_helpers.cpp
321- LIBRARIES ${PROJECT_NAME}
320+ SRCS rcl/client_fixture.cpp
321+ LIBRARIES ${PROJECT_NAME} wait_for_entity_helpers
322322 AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
323323 )
324324
@@ -366,6 +366,14 @@ add_executable(test_rmw_impl_id_check_exe
366366 rcl/test_rmw_impl_id_check_exe.cpp )
367367target_link_libraries (test_rmw_impl_id_check_exe ${PROJECT_NAME} )
368368
369+ # This file is used by many tests, so build it just once
370+ add_library (wait_for_entity_helpers STATIC rcl/wait_for_entity_helpers.cpp )
371+ target_include_directories (wait_for_entity_helpers PRIVATE
372+ ${osrf_testing_tools_cpp_INCLUDE_DIRS} )
373+ target_link_libraries (wait_for_entity_helpers PUBLIC ${PROJECT_NAME} )
374+ target_link_libraries (wait_for_entity_helpers PRIVATE
375+ rcutils::rcutils )
376+
369377call_for_each_rmw_implementation (test_target )
370378
371379rcl_add_custom_gtest (test_validate_enclave_name
0 commit comments