今天用catkin_make编译ros包出现如下错误:
CMake Error at /home/liwei/work/catkin_ws_land/build/mycommbase/cmake/mycommbase-genmsg.cmake:250 (add_custom_target):
add_custom_target cannot create target
"mycommbase_generate_messages_nodejs" because another target with the same
name already exists. The existing target is a custom target created in
source directory "/home/liwei/work/catkin_ws_land/src/tld_tracker". See
documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
/opt/ros/kinetic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
mycommbase/CMakeLists.txt:20 (generate_messages)
最后的找到的原因是包的package.xml 中包依赖没有和cmakelist.txt中设置一致
cmakelist.txt:
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs image_transport mycommbase message_generation)
package.xml:
<build_depend>message_generation</build_depend>
<build_depend>mycommbase</build_depend>
<build_depend>image_transport</build_depend>
<run_depend>message_runtime</run_depend>
<run_depend>mycommbase</run_depend>
<run_depend>image_transport</run_depend>
主要是上面mycommbase是我自己的一个包,一定要在package.xml中 <build_depend> 里面加上