cmake_minimum_required(VERSION 3.8)
project(toid_control)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

set(library_name toid_control)

set(PACKAGE_DEPS
  rclcpp
  pluginlib
  hardware_interface
  rclcpp_lifecycle
  rclcpp_components
)

# find dependencies
find_package(ament_cmake REQUIRED)

foreach(PACKAGE ${PACKAGE_DEPS})
  find_package(${PACKAGE} REQUIRED)
endforeach()


add_library(
  ${library_name}
  SHARED
  src/toid_control.cpp
)

target_include_directories(
  ${library_name}
  PRIVATE
  include
)

ament_target_dependencies(${library_name}
  ${PACKAGE_DEPS}
)

pluginlib_export_plugin_description_file(hardware_interface toid_control_interfaces.xml)

install(
  TARGETS ${library_name} 
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib
  RUNTIME DESTINATION bin
)

install(
  DIRECTORY 
    launch 
    params
    rviz
  DESTINATION share/${PROJECT_NAME}/
)

ament_export_include_directories(include)
ament_export_libraries(${library_name})
ament_export_dependencies(${PACKAGE_DEPS})

ament_package()
