-
Notifications
You must be signed in to change notification settings - Fork 146
Use package.xml version in cmake (using python) #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Copies the python script and cmake helper from gz-cmake to get the package.xml version. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
clalancette
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not opposed to this, but something occurred to me. The data in the package.xml is highly structured XML. Could we not do something as simple as doing a regex? Something like the following:
file(READ package.xml PACKAGE_XML_DATA)
string(REGEX MATCH "<version>([0-9]+)\.([0-9]+)\.([0-9]+)</version>" _ ${PACKAGE_XML_DATA})
set(URDF_MAJOR_VERSION ${CMAKE_MATCH_1})
set(URDF_MINOR_VERSION ${CMAKE_MATCH_2})
set(URDF_PATCH_VERSION ${CMAKE_MATCH_3})
dartsim does something similar: https://github.com/dartsim/dart/blob/59f39923015604b2984b82fc8c964dad9cd598f4/CMakeLists.txt#L72 . |
sure, this is reasonable enough and is more concise. I'll open a separate PR with this approach |
see #236 |
|
the approach from #236 was used instead |
Alternative to #232 for addressing the duplicate package versions specified in cmake and package.xml. Whereas #232 adds a github workflow to verify that the versions are identical, this copies a python script and cmake helper from gazebosim/gz-cmake#456 to get the version from a package.xml file and use it in cmake. This makes python a hard requirement for configuring the urdfdom package.