mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 09:53:34 +08:00
Protobuf-generated code in gz_msgs triggers -Wdouble-promotion warnings from the Abseil library. Since this is external code we cannot modify, disable the warning for this specific target. Fixes #26533
37 lines
1.1 KiB
CMake
37 lines
1.1 KiB
CMake
############################################################################
|
|
#
|
|
# Copyright (c) 2025 PX4 Development Team. All rights reserved.
|
|
#
|
|
############################################################################
|
|
|
|
# Find required packages
|
|
find_package(Protobuf)
|
|
|
|
if (Protobuf_FOUND)
|
|
# Generate protobuf messages
|
|
file(GLOB MSGS_PROTOS "${CMAKE_CURRENT_SOURCE_DIR}/*.proto")
|
|
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${MSGS_PROTOS})
|
|
|
|
# Create library
|
|
add_library(px4_gz_msgs STATIC
|
|
${PROTO_SRCS}
|
|
${PROTO_HDRS}
|
|
)
|
|
|
|
# Disable double-promotion warning for protobuf-generated code
|
|
target_compile_options(px4_gz_msgs PRIVATE -Wno-double-promotion)
|
|
|
|
target_include_directories(px4_gz_msgs
|
|
PUBLIC
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
${Protobuf_INCLUDE_DIRS}
|
|
)
|
|
target_link_libraries(px4_gz_msgs PUBLIC ${PROTOBUF_LIBRARIES})
|
|
if (Protobuf_VERSION VERSION_LESS "3.8")
|
|
target_compile_options(px4_gz_msgs PRIVATE -Wno-error=float-equal)
|
|
endif()
|
|
|
|
# Export the binary dir for other modules
|
|
set(PX4_GZ_MSGS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
|
|
endif()
|