ROS2 setup tutorial: Building with sourced overlay contradicts ROS2 documentation


I’m trying to develop my own ROS2 humble package, using the CLion 2023.3 IDE. Following the ROS2 documentation and also the CLion documentation for ROS2 integration I think there is a contradiction.

As far as I understand, I should have only the underlay, but not my workspace overlay sourced, when building the workspace:

(1)  “Sourcing an overlay in the same terminal where you built, or likewise building where an overlay is sourced, may create complex issues.” ( )

In the CLion documentation the IDE is started from a terminal which has the workspace overlay sourced:

(2) “1. [...]source the workspace setup files:

call install/setup.bat

2. Next, launch CLion from the same shell.“

( )

To rebuild the workspace, the command colcon build is later run from that:

(3) “To (re)build the entire workspace, we will configure an external tool for colcon build and call it without leaving CLion.” ( )

According to (1), (3) should introduce “complex issues” because of (2). What are the issues the ROS2 documentation mentions under (1)? Is anyone successfully using CLion with ROS2? Any issues from sourcing the overlay while building? If so, how did you solve them?

Best regards