Hi,
I've cross-compiled ROS2, but for the Raspberry Pi, though. In any case, you also need to pass --ament-cmake-args (with the same CMake arguments) to ament, just to make sure that Ament CMake packages are cross-compiled as well. Also, you can disable Fast-RTPS' examples by passing -DCOMPILE_EXAMPLES=OFF to the --(ament-)cmake-args option.
For cross-compiling for the Raspberry Pi, I used the cross-compiler from:
https://github.com/raspberrypi/toolsTo have all the dependencies, basically what I did was to fetch the Raspbian ARM image and extract the root filesystem. I then installed all the ROS2 dependencies via QEmu and apt-get, and then used the Raspbian root filesystem to feed the dependencies into CMake. Here's the CMake toolchain I wrote, hope it helps, it's a bit brittle, I'm sure there's a lot of stuff that can be refactored and deduplicated, but so far it works for me:
https://gist.github.com/esteve/a2955dc681c46ac9f8a9222adb239284Please note that I built ROS2 in isolation, so you'll need to adapt the paths in
https://gist.github.com/esteve/a2955dc681c46ac9f8a9222adb239284#file-raspberrypi-toolchain-cmake-L31-L54Let me know if I can help somehow and don't hesitate to ask :-)
Cheers.