|
21 | 21 | # :param var: the output variable name containing the package name |
22 | 22 | # :type var: string |
23 | 23 | # |
24 | | -function(get_default_rmw_implementation var) |
25 | | - get_available_rmw_implementations(middleware_implementations) |
| 24 | +macro(get_default_rmw_implementation var) |
| 25 | + get_available_rmw_implementations(_middleware_implementations) |
26 | 26 |
|
27 | | - if("${middleware_implementations} " STREQUAL " ") |
| 27 | + if("${_middleware_implementations} " STREQUAL " ") |
28 | 28 | message(FATAL_ERROR "Could not find any ROS middleware implementation.") |
29 | 29 | endif() |
30 | 30 |
|
31 | 31 | # option() |
32 | 32 | if(NOT "${ROS_MIDDLEWARE_IMPLEMENTATION} " STREQUAL " ") |
33 | | - set(middleware_implementation "${ROS_MIDDLEWARE_IMPLEMENTATION}") |
| 33 | + set(_middleware_implementation "${ROS_MIDDLEWARE_IMPLEMENTATION}") |
34 | 34 | elseif(NOT "$ENV{ROS_MIDDLEWARE_IMPLEMENTATION} " STREQUAL " ") |
35 | | - set(middleware_implementation "$ENV{ROS_MIDDLEWARE_IMPLEMENTATION}") |
| 35 | + set(_middleware_implementation "$ENV{ROS_MIDDLEWARE_IMPLEMENTATION}") |
36 | 36 | else() |
37 | 37 | # TODO detemine "default" implementation based on the available ones |
38 | | - list(GET middleware_implementations 0 middleware_implementation) |
| 38 | + list(GET _middleware_implementations 0 _middleware_implementation) |
39 | 39 | endif() |
40 | 40 |
|
41 | 41 | # verify that the selection one is available |
42 | | - list(FIND middleware_implementations "${middleware_implementation}" _index) |
| 42 | + list(FIND _middleware_implementations "${_middleware_implementation}" _index) |
43 | 43 | if(_index EQUAL -1) |
44 | | - string(REPLACE ";" ", " middleware_implementations_string "${middleware_implementations}") |
45 | | - message(FATAL_ERROR "Could not find ROS middleware implementation '${middleware_implementation}'. Choose one of the following: ${middleware_implementations_string}") |
| 44 | + string(REPLACE ";" ", " _middleware_implementations_string "${_middleware_implementations}") |
| 45 | + message(FATAL_ERROR "Could not find ROS middleware implementation '${_middleware_implementation}'. Choose one of the following: ${_middleware_implementations_string}") |
46 | 46 | endif() |
47 | | - find_package("${middleware_implementation}" REQUIRED) |
| 47 | + find_package("${_middleware_implementation}" REQUIRED) |
48 | 48 |
|
49 | 49 | # persist implementation decision in cache |
50 | 50 | set( |
51 | | - ROS_MIDDLEWARE_IMPLEMENTATION "${middleware_implementation}" |
| 51 | + ROS_MIDDLEWARE_IMPLEMENTATION "${_middleware_implementation}" |
52 | 52 | CACHE STRING "Select ROS middleware implementation to link against" FORCE |
53 | 53 | ) |
54 | 54 |
|
55 | | - set(${var} ${middleware_implementation} PARENT_SCOPE) |
56 | | -endfunction() |
| 55 | + set(${var} ${_middleware_implementation}) |
| 56 | +endmacro() |
0 commit comments