cmake_minimum_required(VERSION 3.10)
project(tf3_sensor_msgs)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Find dependencies
find_package(Boost COMPONENTS thread REQUIRED)
find_package(GTest REQUIRED)

# Finding Eigen3
find_package(Eigen3 REQUIRED)

if (NOT TARGET tf3)
    add_subdirectory(/home/duongtd/robotics_core/tf3 ${CMAKE_BINARY_DIR}/tf3_build)
endif()

if (NOT TARGET sensor_msgs)
    add_subdirectory(/home/duongtd/robotics_core/common_msgs/sensor_msgs ${CMAKE_BINARY_DIR}/sensor_msgs_build)
endif()

if (NOT TARGET geometry_msgs)
    add_subdirectory(/home/duongtd/robotics_core/common_msgs/geometry_msgs ${CMAKE_BINARY_DIR}/geometry_msgs_build)
endif()

# Include directories
include_directories(
  include
  ${EIGEN3_INCLUDE_DIRS}
  ${Boost_INCLUDE_DIRS}
  ${GTEST_INCLUDE_DIRS}
)

add_library(tf3_sensor_msgs INTERFACE
)

target_include_directories(tf3_sensor_msgs INTERFACE
  ${CMAKE_CURRENT_SOURCE_DIR}/include
)

target_link_libraries(tf3_sensor_msgs INTERFACE 
                      sensor_msgs
                      )

  
add_executable(test_tf2_sensor_msgs test/test_tf2_sensor_msgs.cpp)
target_include_directories(test_tf2_sensor_msgs PUBLIC 
  ${EIGEN3_INCLUDE_DIRS}
  ${GTEST_INCLUDE_DIRS}
  tf3_sensor_msgs
  geometry_msgs
  tf3
)
target_link_libraries(test_tf2_sensor_msgs 
  ${GTEST_LIBRARIES}
  Threads::Threads
  tf3_sensor_msgs
  geometry_msgs
  tf3
)
