Ask Your Question
0

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)
project(netft_rdt_driver)
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})

catkin_package(
    DEPENDS roscpp diagnostic_updater diagnostic_msgs geometry_msgs
    CATKIN_DEPENDS roscpp diagnostic_updater diagnostic_msgs geometry_msgs
    LIBRARIES ${PROJECT_NAME}
)

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

Comments

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 imageDirk Thomas ( 2013-08-21 21:59:32 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 196 times

Last updated: Aug 21 '13