CLion 总是提示 “This file does not belong to any project target xxx” 的解决方法

CLion 总是提示 “此文件不属于任何项目目标,代码洞察功能可能无法正常工作”.

解决办法:
ros2功能包编译时候使用下面这命令编译就好了

colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON