From 0e1a222a37eacf048650b5c61fa33fe9357ab926 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 15 Nov 2024 10:20:22 -0800 Subject: [PATCH] python bindings: get version from package.xml (#556) Requires gz-cmake4 4.1.0. Signed-off-by: Steve Peters --- python/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index aafad62e..69121e10 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,8 +1,9 @@ # Detect if we are doing a standalone build of the bindings, using an external gz-transport if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) cmake_minimum_required(VERSION 3.22.1) - set(GZ_TRANSPORT_VER 14) - project(gz-transport${GZ_TRANSPORT_VER}-python VERSION ${GZ_TRANSPORT_VER}) + find_package(gz-cmake4 4.1.0 REQUIRED) + gz_get_package_xml_version(${CMAKE_SOURCE_DIR}/../package.xml PACKAGE_XML) + project(gz-transport${PACKAGE_XML_VERSION_MAJOR}-python VERSION ${PACKAGE_XML_VERSION}) find_package(gz-transport${PROJECT_VERSION_MAJOR} REQUIRED) set(PROJECT_LIBRARY_TARGET_NAME "gz-transport${PROJECT_VERSION_MAJOR}::gz-transport${PROJECT_VERSION_MAJOR}") # require python dependencies to be found