Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why are Library dependencies not included for interface libraries? #428

Open
lukefrasera opened this issue Feb 24, 2023 · 0 comments
Open

Comments

@lukefrasera
Copy link

When creating interface libraries that depend on other packages ament explicitly doesn't add necessary build dependencies to the target or export target. If you target_link_libraries against an interface library depending on other packages you will get build errors. I am curious why the if(NOT ARG_INTERFACE) checks are needed? If you remove them the generated targets as well as cmake exports work properly and carry the associated dependencies.

if(NOT ARG_INTERFACE)
target_compile_definitions(${target}
${required_keyword} ${definitions})
# the interface include dirs must be ordered
set(interface_include_dirs)
foreach(interface ${interfaces})
get_target_property(_include_dirs ${interface} INTERFACE_INCLUDE_DIRECTORIES)
if(_include_dirs)
list_append_unique(interface_include_dirs ${_include_dirs})
endif()
endforeach()
ament_include_directories_order(ordered_interface_include_dirs ${interface_include_dirs})
# the interface include dirs are used privately to ensure proper order
# and the interfaces cover the public case
target_include_directories(${target} ${system_keyword}
PRIVATE ${ordered_interface_include_dirs})
endif()
ament_include_directories_order(ordered_include_dirs ${include_dirs})
target_link_libraries(${target}
${optional_keyword} ${interfaces})
target_include_directories(${target} ${system_keyword}
${required_keyword} ${ordered_include_dirs})
if(NOT ARG_INTERFACE)
ament_libraries_deduplicate(unique_libraries ${libraries})
target_link_libraries(${target}
${optional_keyword} ${unique_libraries})
foreach(link_flag IN LISTS link_flags)
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${link_flag} ")
endforeach()
endif()
endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant