From 433d8985edc618ac3aa6089edb74d2606605fbe9 Mon Sep 17 00:00:00 2001 From: Lucien Morey Date: Tue, 28 Oct 2025 16:10:05 +1100 Subject: [PATCH 1/4] default to not use vendored tinyxml2 in a ros environment --- CMakeLists.txt | 5 ++++- package.xml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b254b3c2f..fd0dbde77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ option(USE_VENDORED_FLATBUFFERS "Use the bundled version of flatbuffers" ON) option(USE_VENDORED_LEXY "Use the bundled version of lexy" ON) option(USE_VENDORED_MINICORO "Use the bundled version of minicoro" ON) option(USE_VENDORED_MINITRACE "Use the bundled version of minitrace" ON) -option(USE_VENDORED_TINYXML2 "Use the bundled version of tinyxml2" ON) +# Usage of TINYXML2 sits with the ROS2 lookup set(BTCPP_LIB_DESTINATION lib) set(BTCPP_INCLUDE_DESTINATION include) @@ -84,6 +84,7 @@ if(POLICY CMP0057) cmake_policy(SET CMP0057 NEW) endif() +set(_default_use_vendored_tiny_xml ON) find_package(ament_cmake QUIET) if ( ament_cmake_FOUND ) @@ -93,12 +94,14 @@ if ( ament_cmake_FOUND ) message(STATUS "BehaviorTree is being built using AMENT.") message(STATUS "------------------------------------------") include(cmake/ament_build.cmake) + set(_default_use_vendored_tiny_xml OFF) else() message(STATUS "------------------------------------------") message(STATUS "BehaviorTree is being built without AMENT.") message(STATUS "------------------------------------------") include(cmake/conan_build.cmake) endif() +option(USE_VENDORED_TINYXML2 "Use the bundled version of tinyxml2" ${_default_use_vendored_tiny_xml}) ############################################################# # Handle dependencies diff --git a/package.xml b/package.xml index bb7266ea3..fe7b5898f 100644 --- a/package.xml +++ b/package.xml @@ -22,6 +22,7 @@ libsqlite3-dev libzmq3-dev + tinyxml2 ament_cmake_gtest From fd1171a33ffc6014eebb3a4f415b720f6cf32f89 Mon Sep 17 00:00:00 2001 From: Lucien Morey Date: Wed, 29 Oct 2025 11:06:15 +1100 Subject: [PATCH 2/4] try build with the vendor dep too --- package.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/package.xml b/package.xml index fe7b5898f..59a7b62c8 100644 --- a/package.xml +++ b/package.xml @@ -23,6 +23,7 @@ libsqlite3-dev libzmq3-dev tinyxml2 + tinyxml2_vendor ament_cmake_gtest From 8752ed4b02650a7591de3221049e2aaf6e78f05a Mon Sep 17 00:00:00 2001 From: Lucien Morey Date: Wed, 29 Oct 2025 11:18:21 +1100 Subject: [PATCH 3/4] follow alternate lookup based on other pacakges --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd0dbde77..376dd0d6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,7 +147,8 @@ endif() if(USE_VENDORED_TINYXML2) add_subdirectory(3rdparty/tinyxml2) else() - find_package(tinyxml2 REQUIRED) + find_package(tinyxml2_vendor REQUIRED) + find_package(TinyXML2 REQUIRED) endif() list(APPEND BT_SOURCE From 4a780960855735992b9b256d2d401b086ff4ef28 Mon Sep 17 00:00:00 2001 From: Lucien Morey Date: Wed, 29 Oct 2025 11:26:08 +1100 Subject: [PATCH 4/4] split handling for conan and ros --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 376dd0d6e..39e3c55ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,8 +147,12 @@ endif() if(USE_VENDORED_TINYXML2) add_subdirectory(3rdparty/tinyxml2) else() - find_package(tinyxml2_vendor REQUIRED) - find_package(TinyXML2 REQUIRED) + if(ament_cmake_FOUND) + find_package(tinyxml2_vendor REQUIRED) + find_package(TinyXML2 REQUIRED) + else() + find_package(tinyxml2 REQUIRED) + endif() endif() list(APPEND BT_SOURCE