jacknlliu / development-issues

Some issues from my development
MIT License
7 stars 1 forks source link

message headers can't build firstly #41

Open jacknlliu opened 6 years ago

jacknlliu commented 6 years ago

When compiling some ROS package with message and service files, the message headers and service headers may not be built firstly, especially with command catkin_make -j4.

Though we add the following lines to CMakeLists.txt file, the catkin_make -j4 still can't generate message and service headers firstly.

add_message_files(
   FILES
...
 )

add_service_files(
   FILES
...
 )

generate_messages()

Solution:

we should add add_dependencies() for target which need message headers in CMakeLists.txt.

## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
add_dependencies(foo ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

Reference