Skip to content

Commit

Permalink
Switch to target_link_libraries (#36)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Nov 27, 2023
1 parent 1d257eb commit b940588
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
28 changes: 13 additions & 15 deletions urdf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ set(generated_compat_header "${generated_install_path}/${PROJECT_NAME}/urdfdom_c
include_directories(${generated_install_path})
configure_file(urdfdom_compatibility.h.in "${generated_compat_header}" @ONLY)

# Default to C++14
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
Expand All @@ -37,15 +38,14 @@ target_include_directories(${PROJECT_NAME}
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
)
ament_target_dependencies(${PROJECT_NAME}
urdf_parser_plugin
urdfdom
urdfdom_headers
pluginlib
)
target_link_libraries(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} PUBLIC
urdfdom::urdfdom_model
)
target_link_libraries(${PROJECT_NAME} PRIVATE
urdf_parser_plugin::urdf_parser_plugin
urdfdom_headers::urdfdom_headers
pluginlib::pluginlib
)

if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE "URDF_BUILDING_DLL")
Expand All @@ -58,13 +58,11 @@ endif()
add_library(urdf_xml_parser SHARED
src/urdf_plugin.cpp
)
target_link_libraries(urdf_xml_parser
target_link_libraries(urdf_xml_parser PRIVATE
${PROJECT_NAME}
)
ament_target_dependencies(urdf_xml_parser
"pluginlib"
"TinyXML2"
"urdf_parser_plugin"
pluginlib::pluginlib
tinyxml2::tinyxml2
urdf_parser_plugin::urdf_parser_plugin
)

install(TARGETS urdf_xml_parser
Expand Down
4 changes: 2 additions & 2 deletions urdf_parser_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ add_library(urdf_parser_plugin INTERFACE)
target_include_directories(urdf_parser_plugin INTERFACE
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>
)
ament_target_dependencies(urdf_parser_plugin INTERFACE
"urdfdom_headers"
target_link_libraries(urdf_parser_plugin INTERFACE
urdfdom_headers::urdfdom_headers
)

if(BUILD_TESTING)
Expand Down

0 comments on commit b940588

Please sign in to comment.