ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

catkin: Node is build in wrong place

asked 2013-08-21 21:16:46 -0500

liborw gravatar image

I have the following CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
find_package(catkin REQUIRED COMPONENTS roscpp diagnostic_updater diagnostic_msgs geometry_msgs roscpp_serialization)
find_package(Boost REQUIRED COMPONENTS system thread program_options)

include_directories(include ${Boost_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})

add_library(${PROJECT_NAME} src/netft_rdt_driver.cpp)
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})

add_executable(netft_node src/netft_node.cpp)
target_link_libraries(netft_node ${PROJECT_NAME})
target_link_libraries(netft_node ${Boost_LIBRARIES})
target_link_libraries(netft_node ${catkin_LIBRARIES})

    DEPENDS roscpp diagnostic_updater diagnostic_msgs geometry_msgs
    CATKIN_DEPENDS roscpp diagnostic_updater diagnostic_msgs geometry_msgs

The problem is that the executable netft_node does not goes to the usual devel/lib/pkg_name/. but to the build/netft/netft_rdt_driver and rosrun can't find it there. Any idea where is the problem?

edit retag flag offensive close merge delete


Btw you don't have to list the exported dependencies twice - once under DEPENDS and once under CATKIN_DEPENDS. Since all packages listed there are catkin packages you should only list them as CATKIN_DEPENDS and remove DEPENDS completely.

Dirk Thomas gravatar image Dirk Thomas  ( 2013-08-21 21:59:32 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-08-21 21:57:27 -0500

Dirk Thomas gravatar image

You must invoke catkin_package() before adding any targets (libraries and executables). The reason is because catkin_package() will change the location where the targets are built.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-08-21 21:16:46 -0500

Seen: 256 times

Last updated: Aug 21 '13