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.
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})
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, thecatkin_make -j4
still can't generate message and service headers firstly.Solution:
we should add
add_dependencies()
fortarget
which need message headers inCMakeLists.txt
.Reference