add_dependencies(*_generate_messages_cpp) needed when depending on own message package?
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.bash
s again.
Created an issue: https://github.com/ros/catkin/issues/801