diff --git a/rosidl_typesupport_c/cmake/rosidl_typesupport_c_generate_interfaces.cmake b/rosidl_typesupport_c/cmake/rosidl_typesupport_c_generate_interfaces.cmake index c48eda5..c311dc0 100644 --- a/rosidl_typesupport_c/cmake/rosidl_typesupport_c_generate_interfaces.cmake +++ b/rosidl_typesupport_c/cmake/rosidl_typesupport_c_generate_interfaces.cmake @@ -89,6 +89,12 @@ set(Python3_FIND_UNVERSIONED_NAMES FIRST) find_package(Python3 REQUIRED COMPONENTS Interpreter) +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.27) + set(_dep_explicit_only DEPENDS_EXPLICIT_ONLY) +else() + set(_dep_explicit_only "") +endif() + get_used_typesupports(typesupports "rosidl_typesupport_c") add_custom_command( OUTPUT ${_generated_sources} @@ -99,6 +105,7 @@ add_custom_command( DEPENDS ${target_dependencies} COMMENT "Generating C type support dispatch for ROS interfaces" VERBATIM + ${_dep_explicit_only} ) set(_target_suffix "__rosidl_typesupport_c") diff --git a/rosidl_typesupport_cpp/cmake/rosidl_typesupport_cpp_generate_interfaces.cmake b/rosidl_typesupport_cpp/cmake/rosidl_typesupport_cpp_generate_interfaces.cmake index 94c7105..8aae15a 100644 --- a/rosidl_typesupport_cpp/cmake/rosidl_typesupport_cpp_generate_interfaces.cmake +++ b/rosidl_typesupport_cpp/cmake/rosidl_typesupport_cpp_generate_interfaces.cmake @@ -86,6 +86,12 @@ set(Python3_FIND_UNVERSIONED_NAMES FIRST) find_package(Python3 REQUIRED COMPONENTS Interpreter) +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.27) + set(_dep_explicit_only DEPENDS_EXPLICIT_ONLY) +else() + set(_dep_explicit_only "") +endif() + get_used_typesupports(typesupports "rosidl_typesupport_cpp") add_custom_command( OUTPUT ${_generated_sources} @@ -96,6 +102,7 @@ add_custom_command( DEPENDS ${target_dependencies} COMMENT "Generating C++ type support dispatch for ROS interfaces" VERBATIM + ${_dep_explicit_only} ) set(_target_suffix "__rosidl_typesupport_cpp")