Use ament_export_link_flags() to export -rdynamic from tracetools

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
This commit is contained in:
Christophe Bedard 2020-03-08 23:08:25 -04:00
parent 2691fae27f
commit ae9dd2431b
2 changed files with 8 additions and 14 deletions

View file

@ -112,6 +112,13 @@ install(
ament_export_include_directories(include)
if(TRACETOOLS_LTTNG_ENABLED)
ament_export_libraries(${PROJECT_NAME} ${LTTNG_LIBRARIES})
# Export -rdynamic for downtream packages to use when calling
# ament_target_dependencies()
# which is needed to resolve function addresses to symbols when
# using function pointers directly/without std::bind()
# (the flag should not be used on Windows, but TRACETOOLS_LTTNG_ENABLED
# should never be true on Windows anyway, so there is no need to check)
ament_export_link_flags("-rdynamic")
else()
ament_export_libraries(${PROJECT_NAME})
endif()
@ -127,6 +134,7 @@ if(BUILD_TESTING)
if(TRACETOOLS_LTTNG_ENABLED)
ament_add_gtest(test_utils test/test_utils.cpp)
if(TARGET test_utils)
# Since we cannot use ament_target_dependencies(... tracetools) in the same file
target_link_libraries(test_utils ${PROJECT_NAME} -rdynamic)
endif()
endif()