gazebosim / gz-cmake

A set of CMake modules that are used by the C++-based Gazebo projects.
https://gazebosim.org/libs/cmake
Apache License 2.0
27 stars 31 forks source link

Helper to get version number from package.xml #456

Closed scpeters closed 4 weeks ago

scpeters commented 1 month ago

🎉 New feature

Follow-up to https://github.com/gazebosim/gz-math/pull/639, part of https://github.com/gazebosim/sdformat/pull/1491

Summary

This adds a python script and a cmake helper function for getting the version number from a package.xml file.

Test it

Test using the version_from_package_xml example.

  1. Build and install gz-cmake from this branch
  2. cd examples/version_from_package_xml
  3. mkdir build && cd build
  4. cmake ..
  5. You should see the following lines in the console output, pulling the version number from the example package.xml file
-- PACKAGE_XML_VERSION 8.21.65
-- PACKAGE_XML_VERSION_MAJOR 8
-- PACKAGE_XML_VERSION_MINOR 21
-- PACKAGE_XML_VERSION_PATCH 65
-- gz-version_from_package_xml version 8.21.65

Checklist

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.