I'm building ros2 humble from source, I would like to change the default DDS to rmw_cyclonedds_cpp, so with my self built version of ROS2, the user does not have to specify RMW_IMPLEMENTATION and use rmw_cyclonedds_cpp as default.

What source change do I need to or to set some environment variable during ROS2 source building?

I have read this, but did not find the answer for my need.


  • $\begingroup$ I don't know if it is possible. In my opinion, it is a runtime specification. Maybe you can just create a "run.sh" file. In this file, you set the RMW_IMPLEMENTATION variable and launch your nodes. $\endgroup$ Feb 2 at 14:15
  • $\begingroup$ @AntoineVanMalleghem even if I'm compiling ROS2 from source and I can change the ROS2 source? $\endgroup$
    – Felix F Xu
    Feb 3 at 8:37

1 Answer 1


The mechanisms for controlling RMW implementation selection are handled in the rmw_implementation package .

At the time that you are building rmw_implementation, it checks the CMake variable RMW_IMPLEMENTATION to determine which will be the "default" for that build.

Since we are building with cmake, you can pass it as a flag to the cmake invocation cmake .. -DRMW_IMPLEMENTATION=rmw_cyclonedds_cpp. CMake flags can also be passed via colcon with: --cmake-args or --ament-cmake-args:

colcon build --ament-cmake-args -DRMW_IMPLEMENTATION=rmw_cyclonedds_cpp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.