-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,12 @@ Building and installing C++ executables | |
--------------------------------------- | ||
|
||
For this example, suppose you have an executable build target named | ||
``your_node``. | ||
``your_package_node``. | ||
|
||
Although ROS node names are local to the package in which they are | ||
defined, catkin target names must be unique within the catkin | ||
workspace. So, it's best to include the package name in the target | ||
name. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jack-oquin
Author
Owner
|
||
|
||
Headers | ||
::::::: | ||
|
@@ -22,40 +27,41 @@ needed only if that subdirectory of your source package contains | |
headers used to compile your programs. All your catkin package header | ||
dependencies are resolved via ``${catkin_INCLUDE_DIRS}``. | ||
|
||
Other :ref:`how_to_do_common_tasks_2` pages describe how to resolve | ||
header dependencies in more detail. | ||
Other :ref:`how-to pages <how_to_do_common_tasks_2>` describe how to | ||
resolve header dependencies in more detail. | ||
|
||
Building | ||
:::::::: | ||
|
||
To build ``your_node``, add this command to your ``CMakeLists.txt``, | ||
listing all required C++ source files, but not the headers:: | ||
To build ``your_package_node``, add this command to your | ||
``CMakeLists.txt``, listing all required C++ source files, but not the | ||
headers:: | ||
|
||
add_executable(your_node src1.cpp src2.cpp src_etc.cpp) | ||
add_executable(${PROJECT_NAME}_node src1.cpp src2.cpp src_etc.cpp) | ||
|
||
If the list of files is long, a CMake variable can help:: | ||
|
||
set(YOUR_NODE_SOURCES | ||
set(${PROJECT_NAME}_SOURCES | ||
src/file1.cpp | ||
src/file2.cpp | ||
src/file3.cpp | ||
src/file4.cpp | ||
src/file5.cpp | ||
src/file6.cpp | ||
src/file_etc.cpp) | ||
add_executable(your_node ${YOUR_NODE_SOURCES}) | ||
add_executable(${PROJECT_NAME}_node ${${PROJECT_NAME}_SOURCES}) | ||
|
||
If your program depends on libraries provided by other catkin | ||
packages, add this:: | ||
|
||
add_executable(your_node ${YOUR_NODE_SOURCES}) | ||
target_link_libraries(your_node ${catkin_LIBRARIES}) | ||
add_executable(${PROJECT_NAME}_node ${${PROJECT_NAME}_SOURCES}) | ||
target_link_libraries(${PROJECT_NAME}_node ${catkin_LIBRARIES}) | ||
|
||
If your program depends on additional non-catkin system libraries, | ||
include them in the ``target_link_libraries()``:: | ||
|
||
add_executable(your_node ${YOUR_NODE_SOURCES}) | ||
target_link_libraries(your_node | ||
add_executable(${PROJECT_NAME}_node ${${PROJECT_NAME}_SOURCES}) | ||
target_link_libraries(${PROJECT_NAME}_node | ||
${catkin_LIBRARIES} | ||
${Boost_LIBRARIES} | ||
${GSTREAMER_LIBRARIES}) | ||
|
@@ -75,7 +81,7 @@ There are only a few core ROS commands like ``rosrun`` and | |
|
||
List all your executables as TARGETS on an install command like this:: | ||
|
||
install(TARGETS your_node | ||
install(TARGETS ${PROJECT_NAME}_node | ||
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) | ||
|
||
.. _roslaunch: http://wiki.ros.org/roslaunch | ||
|
If it is recommended to prefix the target name with the package name the doc should mention how to override the executable/library name to not contain that prefix (and use that in the following examples).