Skip to content

Commit f68795a

Browse files
sloretzmergify[bot]
authored andcommitted
Document new Humble feature ament_generate_version_header (#2530)
* Document ament_generate_version_header Signed-off-by: Shane Loretz <[email protected]> (cherry picked from commit d22b833)
1 parent b7d7ee8 commit f68795a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

source/Releases/Release-Humble-Hawksbill.rst

+29
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,35 @@ Installation
4545
New features in this ROS 2 release
4646
----------------------------------
4747

48+
49+
ament_cmake_gen_version_h
50+
^^^^^^^^^^^^^^^^^^^^^^^^^
51+
52+
Generating a C/C++ header with version info
53+
"""""""""""""""""""""""""""""""""""""""""""
54+
A new CMake function to generate a header with the package version info was added to the `ament_cmake_gen_version_h` in `ament/ament_cmake#377 <https://github.com/ament/ament_cmake/pull/377>`__.
55+
Here's the simplest use case:
56+
57+
.. code-block:: CMake
58+
59+
project(my_project)
60+
add_library(my_lib ...)
61+
ament_generate_version_header(my_lib)
62+
63+
It will generate a header with version info from the ``package.xml`` and make it available to targets that link against the ``my_lib`` library.
64+
65+
How to include the header:
66+
67+
.. code-block:: C
68+
69+
#include <my_project/version.h>
70+
71+
Where the header is installed to:
72+
73+
.. code-block:: CMake
74+
75+
${CMAKE_INSTALL_PREFIX}/include/my_project/my_project/version.h
76+
4877
launch
4978
^^^^^^
5079

0 commit comments

Comments
 (0)