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

Export a tf2_bullet::tf2_bullet target #495

Merged
merged 2 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions tf2_bullet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ find_package(geometry_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)

if(WIN32)
set(BULLET_ROOT $ENV{ChocolateyInstall}/lib/bullet)
endif()
find_package(Bullet REQUIRED)
include(bullet-extras.cmake)

add_library(tf2_bullet INTERFACE)
target_include_directories(tf2_bullet INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
target_link_libraries(tf2_bullet INTERFACE
tf2_bullet::Bullet
tf2::tf2
${geometry_msgs_TARGETS}
tf2_ros::tf2_ros)

include_directories(include ${BULLET_INCLUDE_DIRS})
install(TARGETS tf2_bullet EXPORT export_tf2_bullet)

install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION include/${PROJECT_NAME}
Expand All @@ -38,12 +45,9 @@ if(BUILD_TESTING)

find_package(ament_cmake_gtest REQUIRED)
ament_add_gtest(test_bullet test/test_tf2_bullet.cpp)
ament_target_dependencies(test_bullet
tf2
geometry_msgs
tf2_ros
)
target_link_libraries(test_bullet tf2_bullet)
endif()

ament_export_include_directories(include)
ament_export_targets(export_tf2_bullet)

ament_package(CONFIG_EXTRAS bullet-extras.cmake)
8 changes: 7 additions & 1 deletion tf2_bullet/bullet-extras.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

# Bullet CMake only exports old-style CMake variables.
# This script makes an imported target for them.

if(WIN32)
set(BULLET_ROOT $ENV{ChocolateyInstall}/lib/bullet)
endif()
find_package(Bullet REQUIRED)

include_directories(SYSTEM ${BULLET_INCLUDE_DIRS})
add_library(tf2_bullet::Bullet INTERFACE IMPORTED)
target_include_directories(tf2_bullet::Bullet INTERFACE ${BULLET_INCLUDE_DIRS})
target_link_libraries(tf2_bullet::Bullet INTERFACE ${BULLET_LIBRARIES})
sloretz marked this conversation as resolved.
Show resolved Hide resolved
target_compile_definitions(tf2_bullet::Bullet INTERFACE ${BULLET_DEFINITIONS})