From e1790d1b45cb8fd1ae166b51f832dc8cc7972c4d Mon Sep 17 00:00:00 2001 From: Anthony Welte Date: Tue, 30 Sep 2025 20:29:29 +0000 Subject: [PATCH 1/2] Add DEPENDS_EXPLICIT_ONLY to remove implicit dependencies Signed-off-by: Anthony Welte --- .../rosidl_typesupport_fastrtps_c_generate_interfaces.cmake | 3 ++- .../rosidl_typesupport_fastrtps_cpp_generate_interfaces.cmake | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_c_generate_interfaces.cmake b/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_c_generate_interfaces.cmake index 49085fb..5eb500d 100644 --- a/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_c_generate_interfaces.cmake +++ b/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_c_generate_interfaces.cmake @@ -88,7 +88,7 @@ rosidl_write_generator_arguments( # the search will prefer /usr/bin/python3 over /usr/bin/python3.11. And that # latter functionality is only available in CMake 3.20 or later, so we need # at least that version. -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.27) # Required by option DEPENDS_EXPLICIT_ONLY of add_custom_command cmake_policy(SET CMP0094 NEW) set(Python3_FIND_UNVERSIONED_NAMES FIRST) @@ -102,6 +102,7 @@ add_custom_command( DEPENDS ${target_dependencies} COMMENT "Generating C type support for eProsima Fast-RTPS" VERBATIM + DEPENDS_EXPLICIT_ONLY ) # generate header to switch between export and import for a specific package diff --git a/rosidl_typesupport_fastrtps_cpp/cmake/rosidl_typesupport_fastrtps_cpp_generate_interfaces.cmake b/rosidl_typesupport_fastrtps_cpp/cmake/rosidl_typesupport_fastrtps_cpp_generate_interfaces.cmake index af089a3..2c9e4ce 100644 --- a/rosidl_typesupport_fastrtps_cpp/cmake/rosidl_typesupport_fastrtps_cpp_generate_interfaces.cmake +++ b/rosidl_typesupport_fastrtps_cpp/cmake/rosidl_typesupport_fastrtps_cpp_generate_interfaces.cmake @@ -98,7 +98,7 @@ rosidl_write_generator_arguments( # the search will prefer /usr/bin/python3 over /usr/bin/python3.11. And that # latter functionality is only available in CMake 3.20 or later, so we need # at least that version. -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.27) # Required by option DEPENDS_EXPLICIT_ONLY of add_custom_command cmake_policy(SET CMP0094 NEW) set(Python3_FIND_UNVERSIONED_NAMES FIRST) @@ -113,6 +113,7 @@ add_custom_command( DEPENDS ${target_dependencies} COMMENT "Generating C++ type support for eProsima Fast-RTPS" VERBATIM + DEPENDS_EXPLICIT_ONLY ) # generate header to switch between export and import for a specific package From 5b70678c6e2b1e37ff99755597b39cb08f6b7114 Mon Sep 17 00:00:00 2001 From: Anthony Welte Date: Thu, 2 Oct 2025 19:35:27 +0000 Subject: [PATCH 2/2] Use version check instead of bumping minimum cmake version Signed-off-by: Anthony Welte --- ...dl_typesupport_fastrtps_c_generate_interfaces.cmake | 10 ++++++++-- ..._typesupport_fastrtps_cpp_generate_interfaces.cmake | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_c_generate_interfaces.cmake b/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_c_generate_interfaces.cmake index 5eb500d..d6cac86 100644 --- a/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_c_generate_interfaces.cmake +++ b/rosidl_typesupport_fastrtps_c/cmake/rosidl_typesupport_fastrtps_c_generate_interfaces.cmake @@ -88,12 +88,18 @@ rosidl_write_generator_arguments( # the search will prefer /usr/bin/python3 over /usr/bin/python3.11. And that # latter functionality is only available in CMake 3.20 or later, so we need # at least that version. -cmake_minimum_required(VERSION 3.27) # Required by option DEPENDS_EXPLICIT_ONLY of add_custom_command +cmake_minimum_required(VERSION 3.20) cmake_policy(SET CMP0094 NEW) 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() + add_custom_command( OUTPUT ${_generated_files} COMMAND Python3::Interpreter @@ -102,7 +108,7 @@ add_custom_command( DEPENDS ${target_dependencies} COMMENT "Generating C type support for eProsima Fast-RTPS" VERBATIM - DEPENDS_EXPLICIT_ONLY + ${_dep_explicit_only} ) # generate header to switch between export and import for a specific package diff --git a/rosidl_typesupport_fastrtps_cpp/cmake/rosidl_typesupport_fastrtps_cpp_generate_interfaces.cmake b/rosidl_typesupport_fastrtps_cpp/cmake/rosidl_typesupport_fastrtps_cpp_generate_interfaces.cmake index 2c9e4ce..a2086bd 100644 --- a/rosidl_typesupport_fastrtps_cpp/cmake/rosidl_typesupport_fastrtps_cpp_generate_interfaces.cmake +++ b/rosidl_typesupport_fastrtps_cpp/cmake/rosidl_typesupport_fastrtps_cpp_generate_interfaces.cmake @@ -98,12 +98,18 @@ rosidl_write_generator_arguments( # the search will prefer /usr/bin/python3 over /usr/bin/python3.11. And that # latter functionality is only available in CMake 3.20 or later, so we need # at least that version. -cmake_minimum_required(VERSION 3.27) # Required by option DEPENDS_EXPLICIT_ONLY of add_custom_command +cmake_minimum_required(VERSION 3.20) cmake_policy(SET CMP0094 NEW) 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() + # Add a command that invokes generator at build time add_custom_command( OUTPUT ${_generated_files} @@ -113,7 +119,7 @@ add_custom_command( DEPENDS ${target_dependencies} COMMENT "Generating C++ type support for eProsima Fast-RTPS" VERBATIM - DEPENDS_EXPLICIT_ONLY + ${_dep_explicit_only} ) # generate header to switch between export and import for a specific package