Skip to content

Commit

Permalink
python bindings: get version from package.xml
Browse files Browse the repository at this point in the history
Requires gz-cmake4 4.1.0.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Nov 14, 2024
1 parent e40c32f commit d128754
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Detect if we are doing a standalone build of the bindings, using an external sdformat
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
cmake_minimum_required(VERSION 3.22.1)
set(SDF_VER 15)
project(sdformat${SDF_VER}-python VERSION ${SDF_VER})
find_package(sdformat${SDF_VER} REQUIRED)
find_package(gz-cmake4 4.1.0 REQUIRED)
gz_get_package_xml_version(${CMAKE_SOURCE_DIR}/../package.xml PACKAGE_XML)
project(sdformat${PACKAGE_XML_VERSION_MAJOR}-python VERSION ${PACKAGE_XML_VERSION})
find_package(sdformat${PROJECT_VERSION_MAJOR} REQUIRED)
set(PROJECT_LIBRARY_TARGET_NAME "sdformat${PROJECT_VERSION_MAJOR}::sdformat${PROJECT_VERSION_MAJOR}")
# require python dependencies to be found
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
Expand Down

0 comments on commit d128754

Please sign in to comment.