ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Ament_cmake BUILD_TESTING on by default?

asked 2019-08-02 14:54:59 -0600

DanRose gravatar image

I found it surprising that find_package(ament_cmake REQUIRED) turns BUILD_TESTING on. Is this on purpose? Why? Does this go against the ROS2 principle of "if I don't use a feature, I shouldn't pay for it"?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-08-02 16:00:20 -0600

sloretz gravatar image

ament_cmake exports a dependency on ament_cmake_test which adds the option BUILD_TESTING. This matches the CTest module which "automatically creates a BUILD_TESTING option that selects whether to enable testing support (ON by default)".

If ament_cmake_test isn't required, then calling find_package() on the individual ament_cmake_* packages needed by a project is the way to go. If ament_cmake_test is needed, the BUILD_TESTING option can be turned off on the command line with the cmake argument -DBUILD_TESTING=OFF. If you're using colcon, use colcon build --cmake-args -DBUILD_TESTING=OFF.

edit flag offensive delete link more


Thanks, @sloretz! It explains a lot that this is an inherited convention :-).

DanRose gravatar image DanRose  ( 2019-08-02 16:32:56 -0600 )edit

Question Tools



Asked: 2019-08-02 14:54:59 -0600

Seen: 993 times

Last updated: Aug 02 '19