diff --git a/ament_cmake_uncrustify/cmake/ament_cmake_uncrustify_lint_hook.cmake b/ament_cmake_uncrustify/cmake/ament_cmake_uncrustify_lint_hook.cmake index 9fcdc89c..fd06953c 100644 --- a/ament_cmake_uncrustify/cmake/ament_cmake_uncrustify_lint_hook.cmake +++ b/ament_cmake_uncrustify/cmake/ament_cmake_uncrustify_lint_hook.cmake @@ -25,11 +25,20 @@ file(GLOB_RECURSE _source_files FOLLOW_SYMLINKS if(_source_files) message(STATUS "Added test 'uncrustify' to check C / C++ code style") + # Forces uncrustify to consider ament_cmake_uncrustify_LANGUAGE as the given language if defined + set(_language "") + if(DEFINED ament_cmake_uncrustify_LANGUAGE) + set(_language LANGUAGE ${ament_cmake_uncrustify_LANGUAGE}) + message(STATUS "Configured uncrustify language: ${ament_cmake_uncrustify_LANGUAGE}") + endif() + set(_args "") if(DEFINED ament_cmake_uncrustify_ADDITIONAL_ARGS) list(APPEND _args ${ament_cmake_uncrustify_ADDITIONAL_ARGS}) endif() message(STATUS "Configured uncrustify additional arguments: ${_args}") - ament_uncrustify(${_args}) + ament_uncrustify( + ${_language} ${_args} + ) endif()