|
1 |
| -# Copyright 2014-2015 Open Source Robotics Foundation, Inc. |
| 1 | +# Copyright 2014-2016 Open Source Robotics Foundation, Inc. |
2 | 2 | #
|
3 | 3 | # Licensed under the Apache License, Version 2.0 (the "License");
|
4 | 4 | # you may not use this file except in compliance with the License.
|
|
16 | 16 |
|
17 | 17 | find_package(rmw_implementation_cmake REQUIRED)
|
18 | 18 | set(default_rmw_implementation "@RMW_IMPLEMENTATION@")
|
| 19 | +set(available_rmw_implementations "@RMW_IMPLEMENTATIONS@") |
19 | 20 |
|
20 | 21 | if(NOT "${RMW_IMPLEMENTATION}" STREQUAL "")
|
21 |
| - set(requested_default_rmw_implementation ${RMW_IMPLEMENTATION}) |
22 |
| - if(NOT requested_default_rmw_implementation STREQUAL default_rmw_implementation) |
23 |
| - message(FATAL_ERROR |
24 |
| - "The default RMW implementation has been specified as " |
25 |
| - "'${requested_default_rmw_implementation}' through CMake," |
26 |
| - "however the default RMW implementation which will be used is " |
27 |
| - "'${default_rmw_implementation}', which was specified when the " |
28 |
| - "'rmw_implementation' package was built.") |
| 22 | + set(requested_rmw_implementation ${RMW_IMPLEMENTATION}) |
| 23 | + if(@RMW_IMPLEMENTATION_SUPPORTS_POCO@) |
| 24 | + if(NOT requested_rmw_implementation IN_LIST available_rmw_implementations) |
| 25 | + message(FATAL_ERROR |
| 26 | + "The RMW implementation has been specified as " |
| 27 | + "'${requested_rmw_implementation}' through CMake, " |
| 28 | + "however it is not in the list of supported rmw implementations, " |
| 29 | + "which was specified when the 'rmw_implementation' package was built.") |
| 30 | + endif() |
| 31 | + else() |
| 32 | + if(NOT requested_rmw_implementation STREQUAL default_rmw_implementation) |
| 33 | + message(FATAL_ERROR |
| 34 | + "The RMW implementation has been specified as " |
| 35 | + "'${requested_rmw_implementation}' through CMake, " |
| 36 | + "however this needs to match the RMW implementation " |
| 37 | + "'${default_rmw_implementation}', " |
| 38 | + "which was specified when the 'rmw_implementation' package was built.") |
| 39 | + endif() |
29 | 40 | endif()
|
30 | 41 | endif()
|
31 | 42 |
|
32 | 43 | if(NOT "$ENV{RMW_IMPLEMENTATION}" STREQUAL "")
|
33 |
| - set(requested_default_rmw_implementation $ENV{RMW_IMPLEMENTATION}) |
34 |
| - if(NOT requested_default_rmw_implementation STREQUAL default_rmw_implementation) |
35 |
| - message(FATAL_ERROR |
36 |
| - "The default RMW implementation has been specified as " |
37 |
| - "'${requested_default_rmw_implementation}' " |
38 |
| - "through the environment variable 'RMW_IMPLEMENTATION', " |
39 |
| - "however the default RMW implementation which will be used is " |
40 |
| - "'${default_rmw_implementation}', which was specified when the " |
41 |
| - "'rmw_implementation' package was built.") |
| 44 | + set(requested_rmw_implementation $ENV{RMW_IMPLEMENTATION}) |
| 45 | + if(@RMW_IMPLEMENTATION_SUPPORTS_POCO@) |
| 46 | + if(NOT requested_rmw_implementation IN_LIST available_rmw_implementations) |
| 47 | + message(FATAL_ERROR |
| 48 | + "The RMW implementation has been specified as " |
| 49 | + "'${requested_rmw_implementation}' through the environment variable " |
| 50 | + "'RMW_IMPLEMENTATION', " |
| 51 | + "however it is not in the list of supported rmw implementations, " |
| 52 | + "which was specified when the 'rmw_implementation' package was built.") |
| 53 | + endif() |
| 54 | + else() |
| 55 | + if(NOT requested_rmw_implementation STREQUAL default_rmw_implementation) |
| 56 | + message(FATAL_ERROR |
| 57 | + "The RMW implementation has been specified as " |
| 58 | + "'${requested_rmw_implementation}' " |
| 59 | + "through the environment variable 'RMW_IMPLEMENTATION', " |
| 60 | + "however this needs to match the RMW implementation " |
| 61 | + "'${default_rmw_implementation}', " |
| 62 | + "which was specified when the 'rmw_implementation' package was built.") |
| 63 | + endif() |
42 | 64 | endif()
|
43 | 65 | endif()
|
44 | 66 |
|
45 |
| - |
46 |
| -set(RMW_IMPLEMENTATION "${default_rmw_implementation}") |
47 |
| -message(STATUS "Using RMW implementation '${RMW_IMPLEMENTATION}' as default") |
48 |
| -find_package("${RMW_IMPLEMENTATION}" REQUIRED) |
| 67 | +if(@RMW_IMPLEMENTATION_SUPPORTS_POCO@) |
| 68 | + set(selected_rmw_implementation "@PROJECT_NAME@") |
| 69 | +else() |
| 70 | + set(selected_rmw_implementation "${default_rmw_implementation}") |
| 71 | + message(STATUS "Using RMW implementation '${selected_rmw_implementation}' as default") |
| 72 | +endif() |
| 73 | +find_package("${selected_rmw_implementation}" REQUIRED) |
49 | 74 |
|
50 | 75 | # TODO should never need definitions and include dirs?
|
51 |
| -list(APPEND rmw_implementation_DEFINITIONS ${${RMW_IMPLEMENTATION}_DEFINITIONS}) |
52 |
| -list(APPEND rmw_implementation_INCLUDE_DIRS ${${RMW_IMPLEMENTATION}_INCLUDE_DIRS}) |
53 |
| -list(APPEND rmw_implementation_LIBRARIES ${${RMW_IMPLEMENTATION}_LIBRARIES}) |
| 76 | +list(APPEND rmw_implementation_DEFINITIONS ${${selected_rmw_implementation}_DEFINITIONS}) |
| 77 | +list(APPEND rmw_implementation_INCLUDE_DIRS ${${selected_rmw_implementation}_INCLUDE_DIRS}) |
| 78 | +list(APPEND rmw_implementation_LIBRARIES ${${selected_rmw_implementation}_LIBRARIES}) |
0 commit comments