Skip to content

Commit

Permalink
Fix undefined symbol error(ref: ethz-asl#667)
Browse files Browse the repository at this point in the history
  • Loading branch information
donghun-han committed Dec 21, 2024
1 parent b07e7e5 commit 9eef498
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions rotors_gazebo_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ file(GLOB msgs msgs/*.proto)
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${msgs})

# Create a shared library of protobuf messages (.so extension on Linux platforms)
add_library(mav_msgs SHARED ${PROTO_SRCS})
target_link_libraries(mav_msgs ${PROTOBUF_LIBRARY} gazebo_msgs)

# add_library(mav_msgs SHARED ${PROTO_SRCS})
# target_link_libraries(mav_msgs ${PROTOBUF_LIBRARY} gazebo_msgs)
add_library(mav_proto_msgs SHARED ${PROTO_SRCS})
target_link_libraries(mav_proto_msgs ${PROTOBUF_LIBRARY} gazebo_msgs)
list(APPEND targets_to_install mav_proto_msgs)
# This causes mav_msgs to be linked with every created library in this file from this
# point forward.
# NOTE: This is deprecated, should be using target_link_libraries instead
link_libraries(mav_msgs)
# link_libraries(mav_msgs)

# ============================================== #
# ==================== CATKIN ================== #
Expand Down Expand Up @@ -245,7 +247,7 @@ if (NOT NO_ROS)
set(target_linking_LIBRARIES ${catkin_LIBRARIES} ${GAZEBO_LIBRARIES})
endif()
endif()

list(APPEND target_linking_LIBRARIES mav_proto_msgs)

# Including GAZEBO_MSG_INCLUDE_DIRS here allows the .cpp files generated by custom .proto files to find
# the .cpp/hpp files generated by the built-in Gazebo .proto files
Expand Down

0 comments on commit 9eef498

Please sign in to comment.