0
$\begingroup$

Rosanswers logo

I installed Groovy and converted my package from rosbuild to catkin following a migration guide.
I wrote my CMakeLists.txt referenced Groovy's sources and CMakeLists.
I run catkin_make, failed about install DESTINATION.

Moirai@moirai:~/moirai-ws$ catkin_make
Base path: /home/Moirai/moirai-ws
Source space: /home/Moirai/moirai-ws/src
Build space: /home/Moirai/moirai-ws/build
Devel space: /home/Moirai/moirai-ws/devel
Install space: /home/Moirai/moirai-ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/Moirai/moirai-ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/Moirai/moirai-ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/groovy
-- This workspace overlays: /opt/ros/groovy
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- catkin 0.5.63
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing packages in topological order:
-- ~~  - my_package
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'my_package'
-- ==> add_subdirectory(my_package)
CMake Error at my_package/CMakeLists.txt:18 (install):
  install TARGETS given no RUNTIME DESTINATION for executable target
  "my_package_node".

My CMakeLists.txt is

cmake_minimum_required(VERSION 2.8.3)
project(my_package)

find_package(catkin REQUIRED COMPONENTS sensor_msgs driver_base image_proc dynamic_reconfigure camera_calibration_parsers compressed_image_transport cv_bridge rospack)
find_package(OpenCV REQUIRED)

# include files
include_directories(${catkin_INCLUDE_DIRS})
include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
include_directories(src/my_package_uvc)
include_directories(${CATKIN_DEVEL_PREFIX}/include/my_package)

# create my_package_node
add_executable(my_package_node src/my_package_node.cpp  src/my_package_uvc/my_package_camera.cpp src/my_package_uvc/my_package_uvc.cpp)
target_link_libraries(my_package_node ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
install(TARGETS my_package_node
    DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

# define the project
   catkin_package(
   INCLUDE_DIRS src/my_package_uvc
   LIBRARIES ${PROJECT_NAME}
   CATKIN-DEPENDS sensor_msgs driver_base image_proc dynamic_reconfigure camera_calibration_parsers compressed_image_transport cv_bridge
   DEPENDS opencv
)
<br>
Where is ${CATKIN_PACKAGE_BIN_DESTINATION}?<br>

What am I doing wrong?


Originally posted by Moirai on ROS Answers with karma: 35 on 2013-02-04

Post score: 2


Original comments

Comment by Moirai on 2013-02-04:
catkin_make run successfully when I set my workspace directory as install destination. install(TARGETS my_package_node DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) I don' know how to configure "${CATKIN_PACKAGE_BIN_DESTINATION}.

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

catkin_package() defines the variable CATKIN_PACKAGE_BIN_DESTINATION and must therefore be called before install(). In your case the variable has not been set and therefore the destination is empty.

Besides that your CMakeLists.txt contains several other flaws:

  • the include directories are ordered badly, first add your local stuff and then global things, else header from other workspaces will overlay your header

  • your include dir should not point to src/my_package_uvc but src instead, and then you should include the header with my_package_uvc/myfile.h.

  • the argument to catkin_package() is CATKIN_DEPENDS not CATKIN-DEPENDS


Originally posted by Dirk Thomas with karma: 16276 on 2013-02-04

This answer was ACCEPTED on the original site

Post score: 6


Original comments

Comment by Moirai on 2013-02-05:
Thanks for your detailed advice. I finished my package's catkin migration! Thank you !!!

$\endgroup$
0
$\begingroup$

Rosanswers logo

use this template for the install macro:

install(TARGETS foo foo_node
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

Also, in your CMakeLists.txt, I believe:

target_link_libraries(my_package ...

should be

target_link_libraries(my_package_node ...

and

catkin_package(
 INCLUDE_DIRS src/my_package_uvc
 LIBRARIES ${PROJECT_NAME}
 ...

should be

catkin_package(
 INCLUDE_DIRS src/my_package_uvc
 # LIBRARIES ${PROJECT_NAME}
 ...

UPDATE: Really use the catkin_create-pkg command for new packages, this generates a CMakeLists.txt for you which should help you make less mistakes.


Originally posted by KruseT with karma: 7848 on 2013-02-04

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

Hi, I'm no expert, but according to [0] you should place catkin_package before add_executable etc. Also I would try linking my_package node instead of my_package: target_link_libraries(my_package_node...

[0] http://www.ros.org/wiki/catkin/CMakeLists.txt#Overall_Structure_and_Ordering


Originally posted by Oier with karma: 145 on 2013-02-04

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.