When you build with `--build-tests`, the `BUILD_TESTING` cmake option is set to true. >From looking at your project, I think you are only appending the target to the list of message targets if `BUILD_TESTING` is true: https://github.com/firesurfer/rosidl_generator_cs/blob/d1bcce9588b0b886355b087e80ae8f48ec976e80/cmake/rosidl_generator_cs_generate_interfaces.cmake#L30 That might explain why it's only failing when you build with `--build-testing` As for why it's failing, [the documentation for `add_custom_target`](https://cmake.org/cmake/help/v3.5/command/add_custom_target.html) says that `add_dependencies()` should be used instead of `DEPENDS` if you're looking to add a dependency on another target, which looks to be your case with `ros2cs_message_generator` - not sure if that helps --- [Visit Topic](http://discourse.ros.org/t/own-message-generator-and-building-tests/796/2) or reply to this email to respond. If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates. ______________________________________________________________________________ ros-users mailing list ros-users@lists.ros.org http://lists.ros.org/mailman/listinfo/ros-users Unsubscribe: