I just wrote the following config
# If ament_gtest is detected, make the tests visible in ROS 2.
find_package(ament_cmake_gtest QUIET)
if ( ament_cmake_gtest_FOUND )
ament_add_gtest_test(test_types)
endif()
When I try to build with this, I get the following error:
CMake Error at /opt/ros/rolling/share/ament_cmake_gtest/cmake/ament_add_gtest_test.cmake:95 (ament_add_test):
Unknown CMake command "ament_add_test".
Call Stack (most recent call first):
test/CMakeLists.txt:21 (ament_add_gtest_test)
It appears that the ament_add_gtest_test macro uses ament_add_test internally (see here), but nothing looks for a dependency on the ament_cmake_test package this comes from.
If I add this line
find_package(ament_cmake_test REQUIRED)
to my config, things work as expected... but I think I shouldn't need to do that, right?