Skip to content

Commit

Permalink
Merge pull request ros2#23 from ros2/fix_windows_test_running
Browse files Browse the repository at this point in the history
extend the library path with the location of the memory tools also
  • Loading branch information
wjwwood committed Feb 12, 2016
2 parents 4ae588f + 775428d commit 02cc077
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 9 additions & 8 deletions rcl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ include(rcl_add_custom_gtest.cmake)

set(extra_test_libraries)
set(extra_test_env)
set(extra_lib_dirs "${rcl_lib_dir}")

# This subdirectory extends both extra_test_libraries and extra_test_env.
# This subdirectory extends both extra_test_libraries, extra_test_env, and extra_lib_dirs.
add_subdirectory(memory_tools)

macro(test_target)
Expand All @@ -31,15 +32,15 @@ function(test_target_function)
rcl_add_custom_gtest(test_allocator${target_suffix}
SRCS rcl/test_allocator.cpp
ENV ${extra_test_env}
APPEND_LIBRARY_DIRS "${rcl_lib_dir}"
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
AMENT_DEPENDENCIES ${rmw_implementation}
)

rcl_add_custom_gtest(test_time${target_suffix}
SRCS rcl/test_time.cpp
ENV ${extra_test_env}
APPEND_LIBRARY_DIRS "${rcl_lib_dir}"
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
AMENT_DEPENDENCIES ${rmw_implementation}
)
Expand All @@ -50,39 +51,39 @@ function(test_target_function)
${extra_test_env}
EMPTY_TEST=
NORMAL_TEST=foo
APPEND_LIBRARY_DIRS "${rcl_lib_dir}"
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
AMENT_DEPENDENCIES ${rmw_implementation}
)

rcl_add_custom_gtest(test_rcl${target_suffix}
SRCS rcl/test_rcl.cpp
ENV ${extra_test_env}
APPEND_LIBRARY_DIRS "${rcl_lib_dir}"
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
AMENT_DEPENDENCIES ${rmw_implementation}
)

rcl_add_custom_gtest(test_node${target_suffix}
SRCS rcl/test_node.cpp
ENV ${extra_test_env}
APPEND_LIBRARY_DIRS "${rcl_lib_dir}"
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
AMENT_DEPENDENCIES ${rmw_implementation}
)

rcl_add_custom_gtest(test_publisher${target_suffix}
SRCS rcl/test_publisher.cpp
ENV ${extra_test_env}
APPEND_LIBRARY_DIRS "${rcl_lib_dir}"
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
AMENT_DEPENDENCIES ${rmw_implementation} "std_msgs"
)

rcl_add_custom_gtest(test_subscription${target_suffix}
SRCS rcl/test_subscription.cpp
ENV ${extra_test_env}
APPEND_LIBRARY_DIRS "${rcl_lib_dir}"
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}${target_suffix} ${extra_test_libraries}
AMENT_DEPENDENCIES ${rmw_implementation} "std_msgs"
)
Expand Down
2 changes: 2 additions & 0 deletions rcl/test/memory_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if(UNIX AND NOT APPLE)
list(APPEND extra_test_libraries dl)
list(APPEND extra_test_env DL_PRELOAD=$<TARGET_FILE:${PROJECT_NAME}_memory_tools>)
endif()
list(APPEND extra_lib_dirs $<TARGET_FILE_DIR:${PROJECT_NAME}_memory_tools>)
target_link_libraries(${PROJECT_NAME}_memory_tools ${extra_test_libraries})
target_compile_definitions(${PROJECT_NAME}_memory_tools
PRIVATE "RCL_MEMORY_TOOLS_BUILDING_DLL")
Expand All @@ -34,3 +35,4 @@ endif()

set(extra_test_libraries ${extra_test_libraries} PARENT_SCOPE)
set(extra_test_env ${extra_test_env} PARENT_SCOPE)
set(extra_lib_dirs ${extra_lib_dirs} PARENT_SCOPE)

0 comments on commit 02cc077

Please sign in to comment.