From 419fc2afe3e0b89d50dc2f6a2759d59d14270ab7 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Thu, 22 Jul 2021 09:39:00 +1000 Subject: [PATCH] Do not link against PYTHON_LIBRARIES on macOS Signed-off-by: Tobias-Fischer --- .../rosidl_generator_py_generate_interfaces.cmake | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake b/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake index 4af35d68..433ce1ad 100644 --- a/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake +++ b/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake @@ -169,10 +169,17 @@ add_dependencies( ${rosidl_generate_interfaces_TARGET}__rosidl_typesupport_c ) -target_link_libraries( - ${_target_name_lib} - ${PythonExtra_LIBRARIES} -) + +if(NOT APPLE) + target_link_libraries( + ${_target_name_lib} + ${PythonExtra_LIBRARIES} + ) +else() + set_target_properties(${_target_name_lib} PROPERTIES + LINK_FLAGS "-undefined dynamic_lookup") +endif() + target_include_directories(${_target_name_lib} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_c