#
# The find_package macro for Orocos-RTT works best with
# cmake >= 2.6.3
#
cmake_minimum_required(VERSION 2.6.3)

project(rtt_ros_param)

#
# Do setup in case of ros package, If ROS_ROOT is set, it is
# recommended to use RTT/OCL through the ros packages.
#
set (ROS_ROOT $ENV{ROS_ROOT} )
if (ROS_ROOT)
  include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
  rosbuild_init()
  rosbuild_find_ros_package( rtt )
  rosbuild_find_ros_package( ocl )
  set( RTT_HINTS HINTS ${rtt_PACKAGE_PATH}/install )
  set( OCL_HINTS HINTS ${ocl_PACKAGE_PATH}/install )
endif()

# Set the CMAKE_PREFIX_PATH in case you're not using Orocos through ROS
# for helping these find commands find RTT.
find_package(OROCOS-RTT REQUIRED ${RTT_HINTS})

rosbuild_find_ros_package(ocl )
list(APPEND CMAKE_MODULE_PATH ${ocl_PACKAGE_PATH}/config)
find_package(RTTPlugin REQUIRED rtt-marshalling)
# Defines the orocos_* cmake macros. See that file for additional
# documentation.
include(${OROCOS-RTT_USE_FILE_PATH}/UseOROCOS-RTT.cmake)

# Creates a component library librtt_ros_param-<target>.so
# and installs in the directory lib/orocos/rtt_ros_param/
#
#orocos_component(rtt_ros_param rtt_ros_param-component.cpp) # ...you may add multiple source files
#
# You may add multiple orocos_component statements.

#
# Building a Plugin or Service (optional):
#
# Creates a plugin library librtt_ros_param-service-<target>.so or librtt_ros_param-plugin-<target>.so
# and installs in the directory lib/orocos/rtt_ros_param/plugins/
#
# Be aware that a plugin may only have the loadRTTPlugin() function once defined in a .cpp file.
# This function is defined by the plugin and service CPP macros.
#
orocos_service(rtt_ros_param-service rtt_ros_param-service.cpp) # ...only one service per library !
target_link_libraries(rtt_ros_param-service ${RTT_PLUGIN_rtt-marshalling_LIBRARIES})
#
# Generates and installs our orocos-rtt_ros_param-<target>.pc and manifest.xml file
#
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/orocos-rtt_ros_param.pc.in ${CMAKE_CURRENT_BINARY_DIR}/orocos-rtt_ros_param-${OROCOS_TARGET}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/orocos-rtt_ros_param-${OROCOS_TARGET}.pc DESTINATION  lib/pkgconfig )
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/manifest.xml DESTINATION  lib/orocos/rtt_ros_param )

#
# Provided 'uninstall' target
#
orocos_uninstall_target()
