How to override DEFAULT_RMW_IMPLEMENTATION ?
When I build things with colcon I see compiler invocations like this:
g++ -DDEFAULT_RMW_IMPLEMENTATION=rmw_fastrtps_cpp ...
I would like to override that preprocessor definition. How do I do that? Something like this has no effect:
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
On a Ubuntu 20.04 host with foxy installed, this is the only file that mentions DEFAULT_RMW_IMPLEMENTATION
:
$ grep -rl 'DEFAULT_RMW_IMPLEMENTATION' /opt/ros/foxy
/opt/ros/foxy/share/rmw_implementation/cmake/rmw_implementationExport.cmake
Within that file, here is the section that sets the CPPFLAGS
:
$ grep -nC2 'DEFAULT_RMW_IMPLEMENTATION' /opt/ros/foxy/share/rmw_implementation/cmake/rmw_implementationExport.cmake
55-
56-set_target_properties(rmw_implementation::rmw_implementation PROPERTIES
57: INTERFACE_COMPILE_DEFINITIONS "DEFAULT_RMW_IMPLEMENTATION=rmw_fastrtps_cpp"
58- INTERFACE_LINK_LIBRARIES "rcpputils::rcpputils;rcutils::rcutils;rmw::rmw"
59-)
Here is the package that provides that file:
$ dpkg -S /opt/ros/foxy/share/rmw_implementation/cmake/rmw_implementationExport.cmake
ros-foxy-rmw-implementation: /opt/ros/foxy/share/rmw_implementation/cmake/rmw_implementationExport.cmake
Here is the version of that package at the time of this writing:
$ apt-cache policy ros-foxy-rmw-implementation
ros-foxy-rmw-implementation:
Installed: 1.0.3-1focal.20220922.205522
Candidate: 1.0.3-1focal.20220922.205522
Version table:
*** 1.0.3-1focal.20220922.205522 500
500 http://packages.ros.org/ros2/ubuntu focal/main amd64 Packages
100 /var/lib/dpkg/status
Short of changing the content of this *.cmake
file for this package, how do I change the default rmw implementation definition used by the preprocessor?