cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(qb_softhand_industry_control VERSION 1.0.9 LANGUAGES CXX)

# Dependency Settings
find_package(catkin REQUIRED
  COMPONENTS
    roscpp
    controller_manager
    qb_softhand_industry_hardware_interface
    qb_softhand_industry_utils
    combined_robot_hw
)

include_directories(include
  ${catkin_INCLUDE_DIRS}
)

catkin_package(
  INCLUDE_DIRS
    include
  LIBRARIES
    ${PROJECT_NAME}
  CATKIN_DEPENDS
    roscpp
    controller_manager
    qb_softhand_industry_hardware_interface
    qb_softhand_industry_utils
    combined_robot_hw
)

# Build Settings
add_executable(qb_softhand_industry_default
  src/main.cpp
  src/qb_softhand_industry_control.cpp
)

target_link_libraries(qb_softhand_industry_default
  PUBLIC
    ${catkin_LIBRARIES}
)

add_dependencies(qb_softhand_industry_default
  ${${PROJECT_NAME}_EXPORTED_TARGETS}
  ${catkin_EXPORTED_TARGETS}
)

# C++ Settings
if (CMAKE_VERSION VERSION_LESS "3.1")
  target_compile_options(qb_softhand_industry_default
    PUBLIC
      "-std=c++14"
  )
else ()
  set_property(
    TARGET
      qb_softhand_industry_default
    PROPERTY CXX_STANDARD 14
  )

  set_property(
    TARGET
      qb_softhand_industry_default
    PROPERTY CXX_STANDARD_REQUIRED ON
  )
endif ()

# Installation
install(
  DIRECTORY
    include/${PROJECT_NAME}/
  DESTINATION
    ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

install(
  DIRECTORY
    launch/
  DESTINATION
    ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)