choose default middleware implementation from available ones

This commit is contained in:
Dirk Thomas 2014-08-08 16:57:41 -07:00
parent 9607869ef2
commit c6c04749ca

View file

@ -1,22 +1,26 @@
# copied from rclcpp/rclcpp-extras.cmake
# option()
ament_index_get_resources(_middleware_implementations "ros_middleware_implementation")
if("${_middleware_implementations}" STREQUAL "")
message(FATAL_ERROR "Could not find any ROS middleware implementation.")
endif()
set(_middleware_implementation "")
# option()
if(NOT "${ROS_MIDDLEWARE_IMPLEMENTATION}" STREQUAL "")
set(_middleware_implementation "${ROS_MIDDLEWARE_IMPLEMENTATION}")
elseif(NOT "$ENV{ROS_MIDDLEWARE_IMPLEMENTATION}" STREQUAL "")
set(_middleware_implementation "$ENV{ROS_MIDDLEWARE_IMPLEMENTATION}")
else()
# detemine "default" implementation based on the available ones
set(_middleware_implementation "ros_middleware_connext_cpp")
if("${_middleware_implementation}" STREQUAL "")
message(FATAL_ERROR "No middleware implementation available.")
endif()
# TODO detemine "default" implementation based on the available ones
list(GET _middleware_implementations 1 _middleware_implementation)
endif()
message("rclcpp_DEFINITIONS ${rclcpp_DEFINITIONS}")
message("rclcpp_INCLUDE_DIRS ${rclcpp_INCLUDE_DIRS}")
message("rclcpp_LIBRARIES ${rclcpp_LIBRARIES}")
list(FIND _middleware_implementations "${_middleware_implementation}" _index)
if(_index EQUAL -1)
string(REPLACE ";" ", " _middleware_implementations_string "${_middleware_implementations}")
message(FATAL_ERROR "Could not find ROS middleware implementation '${_middleware_implementation}'. Choose one of the following: ${_middleware_implementations_string}")
endif()
message(STATUS "Using middleware implementation: ${_middleware_implementation}")
find_package("${_middleware_implementation}" REQUIRED)
@ -30,7 +34,3 @@ set(
list(APPEND rclcpp_DEFINITIONS ${${ROS_MIDDLEWARE_IMPLEMENTATION}_DEFINITIONS})
list(APPEND rclcpp_INCLUDE_DIRS ${${ROS_MIDDLEWARE_IMPLEMENTATION}_INCLUDE_DIRS})
list(APPEND rclcpp_LIBRARIES ${${ROS_MIDDLEWARE_IMPLEMENTATION}_LIBRARIES})
message("rclcpp_DEFINITIONS ${rclcpp_DEFINITIONS}")
message("rclcpp_INCLUDE_DIRS ${rclcpp_INCLUDE_DIRS}")
message("rclcpp_LIBRARIES ${rclcpp_LIBRARIES}")