ament_cmake_clang_format fails to find ament_clang_format package
I am unable to include the ament_clang_format test in my CMakeLists.txt file.
I have tried using ament_lint_auto
package.xml
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>builtin_interfaces</depend>
<depend>rosidl_default_generators</depend>
<test_depend>ament_lint_auto</test_depend>
<!-- <test_depend>ament_lint_common</test_depend> -->
<test_depend>ament_cmake_copyright</test_depend>
<test_depend>ament_cmake_cppcheck</test_depend>
<test_depend>ament_cmake_cpplint</test_depend>
<test_depend>ament_cmake_flake8</test_depend>
<test_depend>ament_cmake_lint_cmake</test_depend>
<test_depend>ament_cmake_pep257</test_depend>
<test_depend>ament_cmake_xmllint</test_depend>
<test_depend>ament_cmake_clang_format</test_depend>
<test_depend>ament_cmake_uncrustify</test_depend>
<test_depend>ament_cmake_gtest</test_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<export>
<build_type>ament_cmake</build_type>
</export>
CMakeLists.txt
if(BUILD_TESTING)
# linters
find_package(ament_lint_auto REQUIRED)
# find_package(ament_clang_format REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
which fails on build (I have ros2 installed and built from source @ /root/ros2_ws/ros2_base)
CMake Error at /root/ros2_ws/ros2_base/install/ament_cmake_clang_format/share/ament_cmake_clang_format/cmake/ament_cmake_clang_format-extras.cmake:19 (include):
include could not find load file:
/root/ros2_ws/ros2_base/install/ament_cmake_clang_format/share/ament_cmake_clang_format/cmake/ament_cmake_clang_format.cmake
Call Stack (most recent call first):
/root/ros2_ws/ros2_base/install/ament_cmake_clang_format/share/ament_cmake_clang_format/cmake/ament_cmake_clang_formatConfig.cmake:38 (include)
/root/ros2_ws/ros2_base/install/ament_lint_auto/share/ament_lint_auto/cmake/ament_lint_auto_find_test_dependencies.cmake:35 (find_package)
CMakeLists.txt:48 (ament_lint_auto_find_test_dependencies)
CMake Error at /root/ros2_ws/ros2_base/install/ament_cmake_clang_format/share/ament_cmake_clang_format/cmake/ament_cmake_clang_format_lint_hook.cmake:27 (ament_clang_format):
Unknown CMake command "ament_clang_format".
Call Stack (most recent call first):
/root/ros2_ws/ros2_base/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:38 (include)
/root/ros2_ws/ros2_base/install/ament_lint_auto/share/ament_lint_auto/cmake/ament_lint_auto_package_hook.cmake:15 (ament_execute_extensions)
/root/ros2_ws/ros2_base/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:38 (include)
/root/ros2_ws/ros2_base/install/ament_cmake_core/share/ament_cmake_core/cmake/core/ament_package.cmake:66 (ament_execute_extensions)
CMakeLists.txt:64 (ament_package)
make: *** [cmake_check_build_system] Error 1
If I use the following in the package.xml
<test_depend>ament_cmake_clang_format</test_depend>
as per https://github.com/ament/ament_lint/b... the test simply does not run.
I CAN, however, run the test from the command line
root@C001721433:~/ros2_ws/ros2_ov# ament_clang_format
No code style divergence in file 'test/test_msg.cpp'
No errors