Cmake error in target_link_libraries, the target is not built in this directory

asked 2016-04-12 09:32:49 -0600

xuao gravatar image

I'm new in ros, after downloading the hector_quadrotor package, many Cmake error occurred while catkin_make, it's about target_link_libraries, but i don't know how to solve it.

For example, Cmake error like this:

CMake Error at hector_quadrotor/hector_quadrotor_gazebo_plugins/CMakeLists.txt:63 (target_link_libraries):
  Attempt to add link library "/usr/lib/x86_64-linux-gnu/libpthread.so" to
  target "hector_gazebo_quadrotor_simple_controller" which is not built in
  this directory.

CMake Error at hector_quadrotor/hector_quadrotor_gazebo_plugins/CMakeLists.txt:63 (target_link_libraries):
  Attempt to add link library
  "/usr/lib/x86_64-linux-gnu/libconsole_bridge.so" to target
  "hector_gazebo_quadrotor_simple_controller" which is not built in this
  directory.

and the related information in CMakeLists.txt like this:

    add_library(hector_gazebo_ros_baro src/gazebo_ros_baro.cpp)
    target_link_libraries(hector_gazebo_ros_baro ${GAZEBO_LIBRARIES} ${catkin_LIBRARIES})
    add_dependencies(hector_gazebo_ros_baro hector_uav_msgs_generate_messages_cpp)

    add_library(hector_gazebo_quadrotor_simple_controller src/gazebo_quadrotor_simple_controller.cpp)
    target_link_libraries(hector_gazebo_quadrotor_simple_controller ${GAZEBO_LIBRARIES} ${catkin_LIBRARIES})

  if(hector_quadrotor_propulsion_LIBRARY)
      add_library(hector_gazebo_quadrotor_propulsion src/gazebo_quadrotor_propulsion.cpp)
      target_link_libraries(hector_gazebo_quadrotor_propulsion ${GAZEBO_LIBRARIES} ${catkin_LIBRARIES} ${hector_quadrotor_propulsion_LIBRARY})
      add_dependencies(hector_gazebo_quadrotor_propulsion hector_uav_msgs_generate_messages_cpp)
    else()
      message(WARNING "Quadrotor propulsion model is not available. Skipping target hector_gazebo_quadrotor_propulsion...")
    endif()

    if(hector_quadrotor_aerodynamics_LIBRARY)
      add_library(hector_gazebo_quadrotor_aerodynamics src/gazebo_quadrotor_aerodynamics.cpp)
      target_link_libraries(hector_gazebo_quadrotor_aerodynamics ${GAZEBO_LIBRARIES} ${catkin_LIBRARIES} ${hector_quadrotor_aerodynamics_LIBRARY})
    else()
      message(WARNING "Quadrotor aerodynamics model is not available. Skipping target hector_gazebo_quadrotor_aerodynamics...")
    endif()

and the line 63 in CMakeLists.txt is :

target_link_libraries(hector_gazebo_quadrotor_simple_controller ${GAZEBO_LIBRARIES} ${catkin_LIBRARIES})

wish for your help! thanks very much!

edit retag flag offensive close merge delete