cmake_minimum_required(VERSION 2.8.3)

set(swri_nodelet_SHARE ${swri_nodelet_PREFIX}/@CATKIN_PACKAGE_SHARE_DESTINATION@)

macro(swri_nodelet_add_node NODELET_NODENAME NODELET_NS NODELET_CLASS)
  find_package(roscpp REQUIRED)
  find_package(nodelet REQUIRED)
  include_directories(${roscpp_INCLUDE} ${nodelet_INCLUDE})
  set(NODELET_NODENAME ${NODELET_NODENAME})
  set(NODELET_NS ${NODELET_NS})
  set(NODELET_CLASS ${NODELET_CLASS})
  configure_file(${swri_nodelet_SHARE}/nodelet.cpp.in "${NODELET_NODENAME}.cpp")
  add_executable(${NODELET_NODENAME} "${NODELET_NODENAME}.cpp")
  target_link_libraries(${NODELET_NODENAME} ${roscpp_LIBRARIES} ${nodelet_LIBRARIES})
  unset(NODELET_NODENAME)
  unset(NODELET_NS)
  unset(NODELET_CLASS)
endmacro()
