0
$\begingroup$

Rosanswers logo

Hello, we've faced a really strange problem. We're moving message/service definitions into standalone packages, and we've faced this:

virtual_camera_msgs/CMakeLists.txt:

make_minimum_required(VERSION 2.8.3)
project(virtual_camera_msgs)

find_package(catkin REQUIRED COMPONENTS message_generation std_msgs)

add_message_files(FILES AddRealCamera.msg VirtualCameraParameters.msg)
generate_messages(DEPENDENCIES std_msgs)

catkin_package(CATKIN_DEPENDS message_runtime std_msgs)

virtual_camera/CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(virtual_camera)

set(THIS_PROJECT_DEPS
  ...
  virtual_camera_msgs
)

find_package(catkin REQUIRED COMPONENTS
  ${THIS_PROJECT_DEPS}
)

catkin_package(CATKIN_DEPENDS ${THIS_PROJECT_DEPS})

include_directories(include ${catkin_INCLUDE_DIRS})

add_executable(keyboard_teleop src/keyboard_teleop.cpp)
target_link_libraries(keyboard_teleop ${catkin_LIBRARIES})

I was almost sure it is not needed to add add_dependencies(keyboard_teleop virtual_camera_msgs_generate_messages_cpp), since CATKIN_DEPENDS on the whole virtual_camera_msgs package should automatically build all of its targets before continuing to the package that includes it.

However, if I don't add the add_dependencies clause, the build fails not finding virtual_camera_msgs/AddRealCamera.h, which should be built by the message package.

Do you know why the generate_messages_cpp target is not run before building the dependent package?

Using catkin_make --use-ninja, I've tried removing build and devel and sourcing the setup.bashs again.


Originally posted by peci1 on ROS Answers with karma: 1366 on 2016-05-23

Post score: 2


Original comments

Comment by peci1 on 2016-05-25:
Created an issue: https://github.com/ros/catkin/issues/801

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Got an answer in the issue. It is said to be a technical limitation of catkin. You should indeed add add_dependencies(target catkin_EXPORTED_TARGETS) to every target that uses (any) ROS messages or other autogenerated code.


Originally posted by peci1 with karma: 1366 on 2016-05-26

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by gvdhoorn on 2016-05-26:\

It is said to be a technical limitation of catkin

I think this is actually a CMake limitation, not necessarily catkin.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.